JSPM

selectors-to-array

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q10534F
  • License MIT

Converts CSS selectors, DOM elements and NodeLists into arrays

Package Exports

  • selectors-to-array

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (selectors-to-array) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

selectors-to-array

Converts CSS selectors, DOM elements and NodeLists into arrays

Install

$ npm install --save selectors-to-array

Usage

const selectorsToArray = require('selectors-to-array')

selectorsToArray('input, button')
// => [input#player-1, input#player-2, button]

selectorsToArray(document.querySelector('input'))
// => [input#player-1]

selectorsToArray(document.querySelectorAll('input'))
// => [input#player-1, input#player-2]

const elements = [
  document.querySelector('#player-1'),
  ...document.querySelectorAll('button')
]
selectorsToArray(elements)
// => [input#player-1, button]

License

MIT © François Chalifour