Feature request: `withoutIndent / removeIndent / dedent`
vorillaz opened this issue · comments
Theodore Vorillas commented
Remove leading whitespace from each line in a string
Example usage
import withoutIndent from '@plexis/without-indent';
withoutIndent('Hello world');
// => 'Hello world'
withoutIndent('\nHello world')
// =>
//'
// Hello world'
withoutIndent('\t\t\t\tHello world')
// => 'Hello world'
withoutIndent('\t\t\t\tHello \nworld')
// => '
// Hello
// world'
withoutIndent('\t\t\t\tHello\tdear \nworld')
// => ' Hello dear
// world'
Aliases
import withoutIndent from '@plexis/without-indent';
import {withoutIndent, removeIndent, dedent} from 'plexis';
Adriaan Vermeire commented
I'd like to take this one on!
Theodore Vorillas commented
@adriaanvermeire Sure thing, go for it!
Adriaan Vermeire commented
Should this package remove all leading whitespaces from the string. Or all leading whitespaces for every line in the string?
withoutIndent('\t\tHello\n\tWorld') // returns 'Hello\n\tWorld
as opposed to
withoutIndent('\t\tHello\n\tWorld') // returns 'Hello\nWorld