Licence
ISC
Version
1.0.2
Deps
0
Size
2 kB
Vulns
0
Weekly
0
Use case
Convert NodeList to Array.
Example 1
Extends NodeList.prototype with .toArray method.
import('nodelistarray');
document.querySelectorAll('p').toArray();
We can then use ES6 array functions:
document.querySelectorAll('p').toArray().map(...)
document.querySelectorAll('p').toArray().filter(...)
Example 2
import nodelistArray from 'nodelistarray';
const arr = nodelistArray(document.querySelectorAll('p'));