23 lines
787 B
JavaScript
23 lines
787 B
JavaScript
|
'use strict';
|
||
|
|
||
|
var domToArray = require('bianco.dom-to-array');
|
||
|
|
||
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||
|
|
||
|
var domToArray__default = /*#__PURE__*/_interopDefaultLegacy(domToArray);
|
||
|
|
||
|
/**
|
||
|
* Simple helper to find DOM nodes returning them as array like loopable object
|
||
|
* @param { string|DOMNodeList } selector - either the query or the DOM nodes to arraify
|
||
|
* @param { HTMLElement } scope - context defining where the query will search for the DOM nodes
|
||
|
* @returns { Array } DOM nodes found as array
|
||
|
*/
|
||
|
function $(selector, scope) {
|
||
|
return domToArray__default["default"](typeof selector === 'string' ?
|
||
|
(scope || document).querySelectorAll(selector) :
|
||
|
selector
|
||
|
)
|
||
|
}
|
||
|
|
||
|
module.exports = $;
|