nodelistarray
v1.0.2
Published
Convert NodeList to Array.
Downloads
3
Maintainers
Readme
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'));