Array.prototype.toObjectByProperty( element=>element.property )
Naveen Chawla
naveen.chwl at gmail.com
Sat Aug 5 10:18:12 UTC 2017
I've often needed to cache array elements by a unique key each element has,
for quick access.
This is a shortcut:
```javascript
const elementsById = elements.toObjectByProperty(element=>element.id);
```
Support?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170805/de8fab34/attachment.html>
More information about the es-discuss
mailing list