nx/packages/devkit/src/utils/strip-indents.ts
2021-01-18 21:46:17 -05:00

21 lines
355 B
TypeScript

/**
* Removes indents, which is useful for printing warning and messages.
*
* Example:
*
* ```typescript
* stripIndents`
* Options:
* - option1
* - option2
* `
* ```
*/
export function stripIndents(strings, ...values) {
return String.raw(strings, ...values)
.split('\n')
.map((line) => line.trim())
.join('\n')
.trim();
}