iterators

iterate over collections in sync & async

7 个版本
安装
npm install iterators
yarn add iterators
pnpm add iterators
bun add iterators
README

Iterators build status

Iterate over collections in sync or async

Example

var iterators = require("iterators")
    , map = iterators.map
    , fs = require("fs")
    , readFile = fs.readFile

map({
    "foo": "test/foo.js"
    , "bar": "test/bar.js"
}, readFile, function (err, files) {
    // files.foo, files.bar
})

Motivation

There are a few minor issues with the iterators on Array.prototype and alternatives provided by underscore / async.

This library fixes the following nitpicks:

  • You can call an iterator on both an array and an object
  • every / some return the truthy / falsey value without coercing to a boolean
  • reduce / reduceRight accept a optional thisValue
  • provides asynchronous implementations of all iterators that use a callback<Error, Value> instead of returning the value

Installation

npm install composite

Tests

make test

Contributors

  • Raynos

MIT Licenced

版本列表
1.0.0 2012-10-20
0.3.3 2012-11-15
0.3.2 2012-11-15
0.3.1 2012-10-10
0.3.0 2012-08-22
0.2.0 2012-08-16
0.1.0 2012-07-15