npm

Need private packages and team management tools?Check out npm Orgs. »

json-parameterization

2.0.0 • Public • Published

json-parameterization - Parameterization of JSON Structures

Parameterize untrusted JSON structures safely. This is basically a very simple library for substituting strings into JSON structures.

Example

var parameterize = require('json-parameterization');
 
var input = {
  "{{key-prefix}}Key":  "{{now}} ms",
  "say":                "{{Hello World | to-lower }}"
};
 
var params = {
  'key-prefix':   'time',
  'now':          function() {
                    return new Date().getTime();
                  },
  'to-lower':     function(param) {
                    return param.toLowerCase();
                  }
};
 
parameterize(input, params);

Result

{
  timeKey:      "1411165317832 ms",
  say:          "hello world"
}

License

The json-parameterization library is released on the MIT license, see the LICENSE for complete license.

Keywords

none

install

npm i json-parameterization

Downloadsweekly downloads

2,253

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability