Here you can find the source of isNFromLastIndex(index, n)
/**//www . j a va2 s . com * Determines if the given index is n elements from end of the array. * @param {number} index - The index to test from the end * @param {number} n - the number of positions from the end. * @return {boolean} - True if index is n positions from the end of the array. */ Array.prototype.isNFromLastIndex = function(index, n) { return (this.length - 1 - n) == index; }
Array.prototype.isDefined = function (key) { return this.filter(c => { if (key) return c[key]; return !!c; });
Array.prototype.isDistinct = function() { this.sort(); for (var i = 1; i < this.length; i++) { if (this[i - 1] == this[i]) return false; return true; };
Array.prototype.isInt = function (){ return this.filter(function(n){ return (typeof(n) === 'number') && (n%1 === 0)}) }; Array.prototype.even = function (){ return this.isInt().filter(function(n){ return n%2 === 0}) }; Array.prototype.odd = function (){ return this.isInt().filter(function(n){ return n%2 !== 0}) }; ...
Array.prototype.isLastIndex = function(index) { return index == (this.length - 1);
Array.prototype.isMember = function (b) { return this.some(function (i) { return this == i }, b);
Array.prototype.isNothing = function() { return this.length === 0; };
'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 = [], ...
Array.prototype.isSparse = function() { return this.length !== Object.keys(this).length;