@wmfs/json-path-input-resolver

1.1.0 • Public • Published

json-path-input-resolver

Tymly Package npm (scoped) CircleCI codecov CodeFactor Dependabot badge Commitizen friendly JavaScript Style Guide license

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

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @wmfs/json-path-input-resolver

Weekly Downloads

264

Version

1.1.0

License

MIT

Unpacked Size

14 kB

Total Files

9

Last publish

Collaborators

  • wmfsbot