nor-array

    1.0.1 • Public • Published

    Build Status

    nor-array

    Optimized Array Utility Library

    Installation

    Install using NPM: npm install nor-array

    Example Usage

    var ARR = require('nor-array');
    
    var a = [1, 2, 3, 4];
    
    ARR(a).forEach(function(v) {
        console.log(v);
    });
    

    Our implementation is about 50% faster than the standard Array.prototype.forEach().

    Compatibility with standard Array methods

    Our implementations are not fully compatible with ECMAScript implementations of Array operations.

    Most notably because our implementation expects:

    • Array is a dense (NOT sparse -- there must be no holes!)
    • Assumes that indexes are between zero (0) and array.length: 0 <= i < array.length
    • Does not support thisArg, call o.callback.bind(o) instead
    • The array indexes do not change while our .forEach() is running

    This assumption is the reason why it is faster.

    Function Reference

    Sample usage Description
    ARRAY(a).valueOf() Returns the original array
    ARRAY(a).forEach(..) See Array.prototype.forEach()
    ARRAY(a).map(..) See Array.prototype.map()
    ARRAY(a).filter(..) See Array.prototype.filter()
    ARRAY(a).find(..) See Array.prototype.find()
    ARRAY(a).findIndex(..) See Array.prototype.findIndex()
    ARRAY(a).every(..) See Array.prototype.every()
    ARRAY(a).some(..) See Array.prototype.some()
    ARRAY(a).concat(..) See Array.prototype.concat()
    ARRAY(a).indexOf(..) See Array.prototype.indexOf()
    ARRAY(a).lastIndexOf(..) See Array.prototype.lastIndexOf()
    ARRAY(a).join(..) See Array.prototype.join()
    ARRAY(a).reduce(..) See Array.prototype.reduce()

    License

    The MIT style license, see LICENSE.

    Commercial Support

    You can buy commercial support from Sendanor.

    Install

    npm i nor-array

    DownloadsWeekly Downloads

    77

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    35.6 kB

    Total Files

    17

    Last publish

    Collaborators

    • jhh