Wondering what’s next for npm?Check out our public roadmap! »

    @1000ch/array-find
    TypeScript icon, indicating that this package has built-in type declarations

    1.2.0 • Public • Published

    array-find Build Status

    Polyfill for Array.prototype.find.

    testling badge

    Usage

    Functionally:

    var find = require('@1000ch/array-find');
     
    function isPrimary(item, index, array) {
      var start = 2;
      while (start <= Math.sqrt(number)) {
        if (number % start++ < 1) {
          return false;
        }
      }
      return (number > 1);
    }
     
    console.log(find([4, 5, 8, 10], isPrimary));
    // => 5

    From Array object:

    require('@1000ch/array-find/shim');
     
    var array = [4, 5, 8, 10];
     
    console.log(array.find(isPrimary));
    // => 5

    License

    MIT: http://1000ch.mit-license.org

    Keywords

    Install

    npm i @1000ch/array-find

    DownloadsWeekly Downloads

    3

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    6.71 kB

    Total Files

    10

    Last publish

    Collaborators

    • avatar