Non-stringifiable to Default: returns tagged template function that replaces any expression that has no toString property with a default value.

const value = n2d('default')`string: ${'foo'} number: ${42} boolean: ${true} null: ${null} undefined: ${undefined}`;
// value === 'string: foo number: 42 boolean: true null: default undefined: default'
  • Parameters

    Returns ((strings: TemplateStringsArray, ...exp: unknown[]) => string)

    Tagged template function that replaces any expression that has no toString property with default.

      • (strings, ...exp): string
      • Parameters

        • strings: TemplateStringsArray
        • Rest...exp: unknown[]

        Returns string