Skip to content

Node.js Module for Parameterization of JSON Structures

License

Notifications You must be signed in to change notification settings

taskcluster/json-parameterization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Node.js Module for Parameterization of JSON Structures

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •