String template tag that accepts any value and returns a string
import { formatJson } from 'string-template-format'
console.log(formatJson`number ${123}; string: ${'abc'}; object: ${{ abc: 123 }}; array: ${[0, 1, 2]}`)
should print:
number: 123; string: "abc"; object: {"abc":123}; array: [0,1,2]
util.inspect
import { formatInspect } from 'string-template-format'
console.log(formatInspect`number ${123}; string: ${'abc'}; object: ${{ abc: 123 }}; array: ${[0, 1, 2]}`)
should print:
number: 123; string: 'abc'; object: { abc: 123 }; array: [ 0, 1, 2 ]
import { tag } from 'string-template-format'
const myTag = tag(value => `[${typeof value} ${value}]`)
console.log(myTag`${123}; ${'abc'}; ${{ abc: 123 }}; ${[0, 1, 2]}`)
should print:
[number 123]; [string abc]; [object [Object object]]; [array 0,1,2]
Generated using TypeDoc