sequential-data-provider

1.0.5 • Public • Published

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:

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

Package Sidebar

Install

npm i sequential-data-provider

Weekly Downloads

0

Version

1.0.5

License

MIT

Last publish

Collaborators

  • kwirke