1.0.5 • Published 8 years ago
sequential-data-provider v1.0.5
#sequential-data-provider
Simple module that provides sequentially rows of data as objects to a function. The objects get their properties' names from the first row of the data.
It is intended to be used as a PHPUnit-like data-provider to provide data to unit tests, although it could be used for any other purpose that fits.
Inspired by:
- PHPUnit's data-providers
- Their javascript counterpart: nodeunit-dataprovider
- Data-table support library where.js
##Installation
Just run
npm install sequential-data-provider --save-dev
Or if you will be using it in production environment, run
npm install sequential-data-provider --save
##Usage
var populate = require('sequential-data-provider');
var data = [
['name', 'age'],
['Frodo', 50],
['Aragorn', 87],
['Legolas', 2931]
];
populate(data, console.log);
Prints:
{ name: 'Frodo', age: 50 }
{ name: 'Aragorn', age: 87 }
{ name: 'Legolas', age: 2931 }
##Test
You can test it by doing:
cd node_modules/sequential-data-provider
npm install
npm test