List of utility methods to do Array Check
isNFromLastIndex(index, n)Array.prototype.isNFromLastIndex = function(index, n) { return (this.length - 1 - n) == index; | |
isNothing()Array.prototype.isNothing = function() { return this.length === 0; }; | |
isNumberArray()'use strict'; Array.prototype.isNumberArray = function() { return !this.some(x => typeof x != 'number'); module.exports = function segmentNumbers(arr) { arr = arr.sort(); if (!arr.isNumberArray()) return []; let container = [], items = [], ... | |
isSparse()Array.prototype.isSparse = function() { return this.length !== Object.keys(this).length; |