valueless
v1.1.0
Published
> Replace values with paths, for use in test fixtures
Downloads
3
Readme
valueless
Replace values with paths, for use in test fixtures
Installation
npm install --save-dev valueless
Usage
Node.js
import valueless from 'valueless';
const data = [{
id: 1,
name: 'Marloes'
}, {
id: 2,
name: 'Rutger'
}];
valueless(data);
// => [{ id: '0.id', name: '0.name' }, { id: '1.id', name: '1.name' }]
valueless(data, { excludes: ['id'] });
// => [{ id: 1, name: '0.name' }, { id: 2, name: '1.name' }]
valueless(data, { prefix: 'API' });
// => [{ id: 'API:0.id', name: 'API:0.name' }, { id: 'API:1.id', name: 'API:1.name' }]
valueless(data, { excludes: ['id'], prefix: 'API' });
// => [{ id: 1, name: 'API:0.name' }, { id: 2, name: 'API:1.name' }]
Command Line
echo '[["Serialised"],["JSON"]]' | valueless
echo '[["Serialised"],["JSON"]]' | valueless --prefix CMS
echo '[["Serialised"],["JSON"]]' | valueless --excludes foo,bar,baz
See valueless --help
for more information.
Background
Not a common use-case at all, but created to see if it could reduce some of the overhead we have when managing test fixtures for JSON returned by contentstack, which we are transforming using reselect.