0.2.0 • Published 9 years ago

valid-json-template v0.2.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

valid-json-template

yeah, because json-template was taken

Deps Version Downloads Circle CI

Why

Because sometimes you have a template like this that needs to be a valid JSON:

var myTemplate = `{
  "user": {
    "age": "{{ age.computed }}",
    "biography": "{{ biography }}",
    "hasBlueEyes": "{{ eyes.areBlue }}",
  }
}`;

with a dataset like this:

{
  "biography": "Hello world, 42.",
  "age":{
    "computed": 25
  },
  "eyes":{
    "areBlue": true
  }
}

and you want this:

{
  "user": {
    "age": 25,
    "biography": "Hello world, 42.",
    "hasBlueEyes": true
  }
}

npm

npm install valid-json-template -S

changelog