Immutable-js: Set difference on Maps

Created on 25 Aug 2015  路  2Comments  路  Source: immutable-js/immutable-js

It would be very useful for me to have set difference operations on Maps as well as sets. For example something like

const map = Immutable.Map({a: 1, b: 2, c: 3});
const set = Immutable.Set([a, b]);
console.log(map.subtract(set)).toJS(); // prints {c: 3}
help wanted

Most helpful comment

See Map#deleteAll (I guess #895 not published yet)

const map = Immutable.Map({a: 1, b: 2, c: 3});
console.log(map.deleteAll(['a', 'b'])).toJS(); // prints {c: 3}
console.log(map.deleteAll(Set.of(['a', 'b']))).toJS(); // prints {c: 3}
console.log(map.deleteAll(List.of(['a', 'b']))).toJS(); // prints {c: 3}

All 2 comments

i can help out if this is not done yet

See Map#deleteAll (I guess #895 not published yet)

const map = Immutable.Map({a: 1, b: 2, c: 3});
console.log(map.deleteAll(['a', 'b'])).toJS(); // prints {c: 3}
console.log(map.deleteAll(Set.of(['a', 'b']))).toJS(); // prints {c: 3}
console.log(map.deleteAll(List.of(['a', 'b']))).toJS(); // prints {c: 3}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jbonta picture jbonta  路  3Comments

sljuka picture sljuka  路  3Comments

evenstensberg picture evenstensberg  路  4Comments

jamesgpearce picture jamesgpearce  路  4Comments

colbyr picture colbyr  路  3Comments