({
options,
content,
}: {
options: any;
content: string;
})
| 1 | // todo: could use magic-string and generate some sourcemaps 🗺 |
| 2 | export function prepareContent({ |
| 3 | options, |
| 4 | content, |
| 5 | }: { |
| 6 | options: any; |
| 7 | content: string; |
| 8 | }) { |
| 9 | if (typeof options !== 'object') { |
| 10 | return content; |
| 11 | } |
| 12 | |
| 13 | if (options.stripIndent) { |
| 14 | content = stripIndent(content); |
| 15 | } |
| 16 | |
| 17 | if (options.prependData) { |
| 18 | content = `${options.prependData}\n${content}`; |
| 19 | } |
| 20 | |
| 21 | return content; |
| 22 | } |
| 23 | |
| 24 | /** Get the shortest leading whitespace from lines in a string */ |
| 25 | function minIndent(s: string) { |
no test coverage detected