@augment-vir/common
Version:
A collection of augments, helpers types, functions, and classes for any JavaScript environment.
17 lines (16 loc) • 415 B
JavaScript
/**
* Indent all lines in a string by 4 spaces * count.
*
* @category String
* @category Package : @augment-vir/common
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
*/
export function indent(value, count = 1) {
return value
.split('\n')
.map((line) => [
' '.repeat(Math.round(count)),
line,
].join(''))
.join('\n');
}