Set prototype methods
February 7, 2019 ยท View on GitHub
Set.prototype.filter
- Added to make all collections similar in capabilities. Should mimic Array.prototype.filter as close as reasonable.
Set.prototype.map
- Added to make all collections similar in capabilities. Should mimic Array.prototype.map as close as reasonable.
Set.prototype.find
- Added to make all collections similar in capabilities. Should mimic Array.prototype.find as close as reasonable.
- Problematic behaviour
Set.prototype.reduce
- Added to make all collections similar in capabilities. Should mimic Array.prototype.reduce as close as reasonable.
- Static linters can check if function used by Set.prototype.reduce is associative and commutative. Otherwise, results can be surprising to user.
Set.prototype.join
- Added to make all collections similar in capabilities. Should mimic Array.prototype.join as close as reasonable.
Set.prototype.some
- Added to make all collections similar in capabilities. Should mimic Array.prototype.some as close as reasonable.
Set.prototype.every
- Added to make all collections similar in capabilities. Should mimic Array.prototype.every as close as reasonable.
Set.prototype.addAll
Set.prototype.addcan't be extended due to pattern ofarr.forEach(set.add, set)andarr.forEach(set.add.bind(set)).- Doesn't create new set like
Set.prototype.union
Set.prototype.deleteAll
Set.prototype.deletecan't be extended due to pattern ofarr.forEach(set.delete, set)andarr.forEach(set.delete.bind(set)).
Map prototype methods
Map.prototype.filter
- Added to make all collections similar in capabilities. Should mimic Array.prototype.filter as close as reasonable.
Map.prototype.mapValues
TBA
Map.prototype.mapKeys
TBA
Map.prototype.reduce
- Added to make all collections similar in capabilities. Should mimic Array.prototype.reduce as close as reasonable.
Map.prototype.find
- Added to make all collections similar in capabilities. Should mimic Array.prototype.find.
- This methods find value and returns it. It can be reasonable to return pair
[key, value]or merge it withfindKey.
Map.prototype.findKey
- This methods find value and returns its key. It can be reasonable to return pair
[key, value]or merge it withfind.
Map.prototype.keyOf(searchElement)
- This methods returns first key where
SameValueZero(p.[[Value]], searchElement)is true.
Map.prototype.some
- Added to make all collections similar in capabilities. Should mimic Array.prototype.some as close as reasonable.
Map.prototype.every
- Added to make all collections similar in capabilities. Should mimic Array.prototype.some as close as reasonable.
Map.prototype.includes
- Added to make all collections similar in capabilities. Should mimic Array.prototype.includes as close as reasonable.
Map.prototype.update
TBA
Map.prototype.deleteAll
TBA
Map.prototype.merge
TBA
Map static methods
Map.groupBy
TBA
Map.keyBy
TBA