0.3.0 • Published 6 years ago

expand-json v0.3.0

Weekly downloads
8
License
MIT
Repository
github
Last release
6 years ago

expand-json

Expand templates on JSON

This tool allows you expand templates on a JSON.
It uses Mustache¹ as template engine and has custom helpers.
¹: it doest not escape HTML automatically

Install

npm install expand-json

Usage

import { expandJson } from 'expand-json'

const mapping = {
  full_name: '{{name}} {{last_name}}',
  age: '{{age}}'
}

const payload = {
  name: 'Thomas',
  last_name: 'Anderson',
  age: '36',
}

const json = expandJson(mapping, payload)

console.log(json) // { full_name: 'Thomas Anderson', age: '36' }

Roadmap

  • expand templates on json
  • add upper helper: {{#upper}}{{name}}{{/upper}}
  • add custom escaping
0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago