Get unlimited public & private packages + team-based management with npm Teams.Learn more »

lupus

0.0.1 • Public • Published

node-lupus

NPM Version NPM Downloads Build Status

Async looping for Node.js

Banana Peel Sketch

Meta

Installation

To install lupus using npm, simply run:

$ npm install lupus

In the root of your project directory.

Usage

Once you have lupus installed, you can use it to easily iterate over a large set of numbers asynchronously (without locking up the CPU!):

var lupus = require('lupus');
 
lupus(0, 100000, function(n) {
  console.log("We're on:", n);
});

Want to run some code after the loop is finished? No problem!

var lupus = require('lupus');
 
lupus(0, 1000000, function(n) {
  console.log("We're on:", n);
}, function() {
  console.log('All done!');
});

If you were to try the same thing with a typical for loop, you'd use up a TON of memory on your computer, as well as block the Node.js process from executing any other code (bad). Don't believe me? Try running the code sample below yourself =)

for (var i = 0; i < 10000000; i++) {
  console.log("We're on:", i);
}
 
console.log('All done!');

Author's Note

I didn't want to call this library lupus, but I didn't really have a choice since looper was already taken! Darn.

I kinda-sorta figured oh well, let's just do this the weird way. Screw it.

Changelog

v0.0.1: 9-19-2014

- First release!

Install

npm i lupus

DownloadsWeekly Downloads

816

Version

0.0.1

License

UNLICENSE

Last publish

Collaborators

  • avatar