Nodejs Array Check isLastIndex(index)

Here you can find the source of isLastIndex(index)

Method Source Code

/**/*from  w w w . jav a  2 s .c  om*/
 * Determines if the index is the index of the last element in the array
 * @param {number} index - The index to check
 * @param {Array} array - The array to check
 * @return {boolean} true if the index is the last element
 */
Array.prototype.isLastIndex = function(index) {
   return index == (this.length - 1);
}

Related

  1. isBlank()
    function proxy(func, context, args) {
        return function () {
            return func.apply(context, args);
    Array.prototype.isBlank = function () {
        return !this.length;
    };
    
  2. isCharPresent(charSearch)
    Array.prototype.isCharPresent = function(charSearch) {
      var arr = this;
      var result = [];
      var testingStr = '';
      if (charSearch.length > 1) {
        return "You're searching for more than one char";
      for (var i = 0; i < this.length; i++) {
        if (arr[i].indexOf(charSearch) === -1) {
    ...
    
  3. isDefined(key)
    Array.prototype.isDefined = function (key) {
        return this.filter(c => {
            if (key) return c[key];
            return !!c;
        });
    
  4. isDistinct()
    Array.prototype.isDistinct = function() {
      this.sort();
      for (var i = 1; i < this.length; i++) {
        if (this[i - 1] == this[i])
          return false;
      return true;
    };
    
  5. isInt()
    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})
    };
    ...
    
  6. isMember(b)
    Array.prototype.isMember = function (b) {
      return this.some(function (i) {
        return this == i
      }, b);
    
  7. isNFromLastIndex(index, n)
    Array.prototype.isNFromLastIndex = function(index, n) {
      return (this.length - 1 - n) == index;
    
  8. isNothing()
    Array.prototype.isNothing = function() {
      return this.length === 0;
    };
    
  9. 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 = [],
    ...