Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

bianco.dom-to-array

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bianco.dom-to-array

Converts any DOM node/s to a loopable array


Version published
Weekly downloads
678
decreased by-30.32%
Maintainers
1
Weekly downloads
 
Created

bianco.dom-to-array

Build Status

NPM version NPM downloads MIT License

Usage

import domToArray from 'bianco.dom-to-array'

var div = document.createElement('div')
div.innerHTML = `
  <ul>
    <li>one</li>
    <li>two</li>
  </ul>
`
body.appendChild(div)

// It can convert node list
const lis = document.querySelectorAll('li')
const $lis = domToArray(lis)
$lis.length // => 2
Array.isArray($lis) // => true

// It can convert a single node
const li = document.querySelector('li')
const $li = domToArray(li)
$li.length // => 1
Array.isArray($li) // => true

API

domToArray

Converts any DOM node/s to a loopable array

Parameters

Returns Array always a loopable object

FAQs

Package last updated on 22 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts