npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

breeze-async

v0.1.0

Published

Simple series and parallel flow control.

Downloads

280

Readme

breeze-async Build Status

Simple series and parallel flow control.

Installation

Node.js

breeze-async is available on npm.

$ npm install breeze-async

Component

breeze-async is available as a component.

$ component install qualiancy/breeze-async

Usage

Once you require breeze-async, the following API will be available.

var async = require('breeze-async');

.forEach (array, iterator, done)

  • @param {Array} array to iterate
  • @param {Function} iterator function
  • @param {Function} callback on complete or error
  • @cb {Error|null} if error

Apply an iterator to each item in an array in parellel. Execute a callback when all items have been completed or immediately if there is an error provided.

async.forEach([ 1, 2, 3 ], function (i, next) {
  setTimeout(function () {
    console.log(i);
    next();
  }, 10);
}, function (err) {
  should.not.exist(err);
  console.log('all done');
});

.forEachSeries (array, iterator, done)

  • @param {Array} array to iterate
  • @param {Function} iterator function
  • @param {Function} callback on complete or error
  • @cb {Error|null} if error

Apply an iterator to each item in an array serially. Execute a callback when all items have been completed or immediately if there is is an error provided.

async.forEachSeries([ 1, 2, 3 ], function (i, next) {
  setTimeout(function () {
    console.log(i);
    next();
  }, 10);
}, function (err) {
  should.not.exist(err);
  console.log('all done');
});

.parallel (fns, done)

  • @param {Array|Object} functions to execute
  • @param {Function} callback on completion or error
  • @cb {Error|null} if error
  • @cb {Array|Object} reflecting the results

Execute a collection of functions in parellel and execute a callback upon completion or occurance of an error. Functions can be provided as either an array or an object. Each function will be passed a callback to signal completion. The callback accepts either an error for the first argument, or null for the first argument and results following. The results will be provied as the second argument of the callback in-kind, maintaining the order of the input array or the keys of the input object.

Asrray
async.parallel([
    function (next) {
      setTimeout(function () {
        next(null, 'one');
      }, 15);
    }
  , function (next) {
      setTimeout(function () {
        next(null, 'two');
      }, 10);
    }
  , function (next) {
      setTimseout(function () {
        next(null, 'three');
      }, 5);
    }s
], function (err, res) {
  should.not.exist(err);
  res.should.deep.equal([ 'one', 'two', 'three' ]);
});
Object
async.parallel({
    one: function (next) {
      setTimeout(function () {
        next(null, 'one');
      }, 15);
    }
  , two: function (next) {
      setTimeout(function () {
        next(null, 'two');
      }, 10);
    }
  , three: function (next) {
      setTimeout(function () {
        next(null, 'three');
      }, 5);
    }
}, function (err, res) {
  should.not.exist(err);
  res.should.deep.equal({
      one: 'one'
    , two: 'two'
    , three: 'three'
  });
});

series (fns, done)

  • @param {Array|Object} functions to execute
  • @param {Function} callback on completion or error
  • @cb {Error|null} if error
  • @cb {Array|Object} reflecting the results

Execute a collection of functions serially and execute a callback upon completion or occurance of an error. Functions can be provided as either an array or an object. Each function will be passed a callback to signal completion. The callback accepts either an error for the first argument, or null for the first argument and results following. The results will be provied as the second argument of the callback in-kind, maintaining the order of the input array or the keys of the input object.

Asrray
async.series([
    function (next) {
      setTimeout(function () {
        next(null, 'one');
      }, 15);
    }
  , function (next) {
      setTimeout(function () {
        next(null, 'two');
      }, 10);
    }
  , function (next) {
      setTimseout(function () {
        next(null, 'three');
      }, 5);
    }s
], function (err, res) {
  should.not.exist(err);
  res.should.deep.equal([ 'one', 'two', 'three' ]);
});
Object
async.series({
    one: function (next) {
      setTimeout(function () {
        next(null, 'one');
      }, 15);
    }
  , two: function (next) {
      setTimeout(function () {
        next(null, 'two');
      }, 10);
    }
  , three: function (next) {
      setTimeout(function () {
        next(null, 'three');
      }, 5);
    }
}, function (err, res) {
  should.not.exist(err);
  res.should.deep.equal({
      one: 'one'
    , two: 'two'
    , three: 'three'
  });
});

License

(The MIT License)

Copyright (c) 2012 Jake Luer [email protected] (http://qualiancy.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.