Nodejs Utililty Methods Array Check

List of utility methods to do Array Check

Description

The list of methods to do Array Check are organized into topic(s).

Method

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;