Programmatic Usage

Install locally: npm install npm-install-version --save-dev

Basic Example

Let's say we want to benchmark a few versions of csjs against each other:

constniv=require('npm-install-version');
constbenchmark=require('./some-benchmark-function.js');
niv.install('csjs@1.0.0');
// installs csjs@1.0.0 to node_modules/csjs@1.0.0/niv.install('csjs@1.0.1');
// installs csjs@1.0.1 to node_modules/csjs@1.0.1/constcsjs_old=niv.require('csjs@1.0.0');
constcsjs_new=niv.require('csjs@1.0.1');
// require the old and new versions of csjsbenchmark([csjs_old, csjs_new], 'some-test-input');
// run our fake benchmark function on the old and new versions of csjs