Constructs substitution
Signature:
export declare function sub(something: unknown, substitution: string): SubstitutionToken;
Parameter | Type | Description |
---|---|---|
something | unknown | what to substitute |
substitution | string | an actual string substitution |
Returns:
token that could be used inside of fmt
template literal
import { sub, fmt } from 'fmt-subs'
const fmtInstance = fmt`Hello, ${sub({ value: 'World' }, '%o')}!`
// deep equality
fmtInstance.assemble() == ['Hello, %o!', { value: 'World' }]