Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

damage

pedronasser45MIT0.0.6

A simple way to calculate the 'damage' of running a task in Node.JS.

benchmark, calculate, damage, process, memory, delay, leak, heap

readme

damage

A simple way to calculate the damage a task in Node.JS.

Installation

$ npm install damage

Calculating the damage

Create a file requiring damage and running damage(). Just like this:

var damageOf = require('damage');
var fs = require('fs');

//        \/ Task's description
damageOf('reading a file',function (done) {

  // Put the task here..

  fs.readFile(__filename,done);
  //                      /\ Function to be called when the task is done.

},1000);
// /\ How many times

Manipulating the result

You can intercept the result display and do what ever you want with it.

// Same code as before
var damageOf = require('damage');
var fs = require('fs');

damageOf('reading a file',function (done) {
  fs.readFile(__filename,done);
},1000)

// Add \/ after the damage.
.is(function (result) {
  fs.writeFile('output.log',result);
})