1.0.2 • Published 4 years ago

nodelistarray v1.0.2

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

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'));