json-contextify

0.2.0 • Public • Published

JSON Contextify

Install

npm install json-contextify

Sample

  1. Mustache
var jsonContextify = require('json-contextify');
var rawJson = {
    foo: '{{bar}}',
    bar: ['{{baz}} {{zoo}}'],
    baz: 'hi',
    zoo: 'json'
}
// default is mustache
jsonContextify(rawJson) // => { foo: [ 'hi json' ], bar: [ 'hi json' ], baz: 'hi' }

  1. ERB
var jsonContextify = require('json-contextify');
var rawJson = {
    foo: '<%=bar%>',
    bar: ['<%=baz%>'],
    baz: 'hi'
}
jsonContextify(rawJson, 'erb') // => { foo: [ 'hi' ], bar: [ 'hi' ], baz: 'hi' }

  1. ES
var jsonContextify = require('json-contextify');
var rawJson = {
    foo: '${bar}',
    bar: ['${baz}'],
    baz: 'hi'
}
jsonContextify(rawJson, 'es') // => { foo: [ 'hi' ], bar: [ 'hi' ], baz: 'hi' }

Readme

Keywords

none

Package Sidebar

Install

npm i json-contextify

Weekly Downloads

0

Version

0.2.0

License

ISC

Last publish

Collaborators

  • yuanyan