( formatter: Formatter<T>, code: string, opts: TemplateOpts, )
| 6 | import populatePlaceholders from "./populate.ts"; |
| 7 | |
| 8 | export default function stringTemplate<T>( |
| 9 | formatter: Formatter<T>, |
| 10 | code: string, |
| 11 | opts: TemplateOpts, |
| 12 | ): (arg?: unknown) => T { |
| 13 | code = formatter.code(code); |
| 14 | |
| 15 | let metadata: Metadata; |
| 16 | |
| 17 | return (arg?: unknown) => { |
| 18 | const replacements = normalizeReplacements(arg); |
| 19 | |
| 20 | if (!metadata) metadata = parseAndBuildMetadata(formatter, code, opts); |
| 21 | |
| 22 | return formatter.unwrap(populatePlaceholders(metadata, replacements)); |
| 23 | }; |
| 24 | } |
no test coverage detected