Indent each line in a string
$ npm install indent-string
const indentString = require('indent-string');
indentString('Unicorns\nRainbows', 4);
//=> ' Unicorns'
//=> ' Rainbows'
indentString('Unicorns\nRainbows', 4, {indent: '♥'});
//=> '♥♥♥♥Unicorns'
//=> '♥♥♥♥Rainbows'
Type: string
String you want to indent.
Type: number
Default: 1
How many times you want indent
repeated.
Type: Object
Type: string
Default: ' '
String to use for the indent.
Type: boolean
Default: false
Also indent empty lines.
MIT © Sindre Sorhus