Options
All
  • Public
  • Public/Protected
  • All
Menu

string-template-format-inspect — Reference

String Template Format: Inspect

String template literal tag that uses Node's util.inspect

Usage Examples

Without Options

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

should print:

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

With Options

import { InspectFormatter } from 'string-template-format-inspect'
const dbg = InspectFormatter({ getters: true, maxArrayLength: 0 })
const myObject = { get abc () { return 123 }, def: [0, 1, 2] }
console.log(dbg`my object is ${myObject}`)

should print:

my object is { abc: [Getter: 123], def: [ ... 3 more items ] }

License

MIT © Hoàng Văn Khải

Generated using TypeDoc