lupusdeprecated

Async looping for Node.js.

Usage no npm install needed!

<script type="module">
  import lupus from 'https://cdn.skypack.dev/lupus';
</script>

README

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!