npm.io
0.1.7 • Published 6 years ago

string-template-format-json

Licence
MIT
Version
0.1.7
Deps
4
Size
2 kB
Vulns
0
Weekly
0
Stars
10

String Template Format: JSON

String template literal tag that converts values to JSON text

Usage

import json from 'string-template-format-json'
console.log(json`number ${123}; string: ${'abc'}; object: ${{ abc: 123 }}; array: ${[0, 1, 2]}`)

should print:

number: 123; string: "abc"; object: {"abc":123}; array: [0,1,2]

License

MIT Hoàng Văn Khải

Keywords