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

bianco.dom-to-array

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bianco.dom-to-array - npm Package Compare versions

Comparing version 0.0.2 to 0.0.4

16

index.js
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var isIterable = _interopDefault(require('bianco.is-iterable'));
/**
* Converts any DOM node/s into a loopable array like object
* Converts any DOM node/s to a loopable array
* @param { HTMLElement|NodeList } els - single html element or a node list

@@ -14,3 +10,3 @@ * @returns { Object } always a loopable object

// can this object be already looped?
if (!isIterable(els)) {
if (!Array.isArray(els)) {
// is it a node list?

@@ -22,8 +18,8 @@ if (els.length)

// it will be returned as "array" with one single entry
return Array.from({ length: 1 }, _ => els)
} else
// this object could be looped out of the box
return els
return [els]
}
// this object could be looped out of the box
return els
}
module.exports = domToArray;

@@ -1,5 +0,3 @@

import isIterable from 'bianco.is-iterable'
/**
* Converts any DOM node/s into a loopable array like object
* Converts any DOM node/s to a loopable array
* @param { HTMLElement|NodeList } els - single html element or a node list

@@ -10,3 +8,3 @@ * @returns { Object } always a loopable object

// can this object be already looped?
if (!isIterable(els)) {
if (!Array.isArray(els)) {
// is it a node list?

@@ -18,6 +16,6 @@ if (els.length)

// it will be returned as "array" with one single entry
return Array.from({ length: 1 }, _ => els)
} else
// this object could be looped out of the box
return els
return [els]
}
// this object could be looped out of the box
return els
}
{
"name": "bianco.dom-to-array",
"version": "0.0.2",
"description": "Covert DOM node/s into an array like object",
"version": "0.0.4",
"description": "Converts any DOM node/s to a loopable array",
"main": "index.js",

@@ -39,6 +39,3 @@ "jsnext:main": "index.next.js",

"jsdom-global": "2.1.0"
},
"dependencies": {
"bianco.is-iterable": "^0.0.1"
}
}

@@ -29,3 +29,3 @@ # bianco.dom-to-array

$lis.length // => 2
typeof $lis // => 'object'
Array.isArray($lis) // => true

@@ -36,3 +36,3 @@ // It can convert a single node

$li.length // => 1
typeof $li // => 'object'
Array.isArray($li) // => true

@@ -43,3 +43,3 @@ ```

- `domToArray` Converts any DOM node/s into a loopable array like object
- `domToArray` Converts any DOM node/s to a loopable array

@@ -46,0 +46,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc