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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

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