@wmfs/json-path-input-resolver
v1.1.0
Published
Resolve a template containing JSONPath with some given JSON input data
Downloads
4,408
Readme
json-path-input-resolver
Resolve a template containing JSONPath with some given JSON input data
Install
$ npm install @wmfs/json-path-input-resolver --save
Usage
const resolver = require('@wmfs/json-path-input-resolver')
const result = resolver(
{
world: 'Earth',
nested: {
object: 'Yep, this one!'
},
item1: 'Apple',
item2: 'Banana'
},
{
hello: '$.world',
array: ['$.item1', '$.item2'],
nested: {
another: '$.nested.object'
}
}
)
result
will look like the following:
{
"hello": "Earth",
"array": ["Apple", "Banana"],
"nested": {
"another": "Yep, this one!"
}
}
Tests
$ npm test