UNPKG

@kickscondor/umbrellajs

Version:

Lightweight and intuitive javascript library

15 lines (12 loc) 539 B
// [INTERNAL USE ONLY] // Force it to be an array AND also it clones them // http://toddmotto.com/a-comprehensive-dive-into-nodelists-arrays-converting-nodelists-and-understanding-the-dom/ u.prototype.slice = function (pseudo) { // Check that it's not a valid object if (!pseudo || pseudo.length === 0 || typeof pseudo === 'string' || pseudo.toString() === '[object Function]') return []; // Accept also a u() object (that has .nodes) return pseudo.length ? [].slice.call(pseudo.nodes || pseudo) : [pseudo]; };