nodelistarray

1.0.2 • Public • Published

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

/nodelistarray/

    Package Sidebar

    Install

    npm i nodelistarray

    Weekly Downloads

    1

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    1.6 kB

    Total Files

    4

    Last publish

    Collaborators

    • shemsiu