Closed johnjbarton closed 10 years ago
Loader implements the Map interface. If you want an array of the keys do:
[...map.keys()]
or
Array.from(map.keys())
Agreed.
Loader implements the Map interface, but the API function 'keys()' is inconsistent with the rest of ES6 where keys() returns an array. This kind of inconsistency makes APIs harder to use.
Array|Map|Set.prototype.keys()
all return Iterator objects, not arrays.
Since ES Object.keys() and many other ES function ending in 's' return arrays, devs deserve an array from Loader.keys(). If that is somehow impossible, then we need a better name for the function. An obvious choice would be Loader.keyIterator().