✂️ Space trim
Spacetrim is trimming string from all 4 sides.
It is very helpfull to keep pretty code indentation without keeping strange spaces inside strings.
░░░░░░░░░░░░░
░░░░░░░░░░░░░░
░░░░░░░╔═════╗░
░░░░░░░║Hello║░░
░░░░░░░║Space║░░░
░░░░░░░║Trim ║░░░░
░░░░░░░╚═════╝░░░░░
░░░░░░░░░░░░░░░░░░░░
Usage
npm i spacetrim
import { spaceTrim } from 'spacetrim';
const trimmed = spaceTrim(`
Hello
Space
Trim
`);
console.log(trimmed);
See more examples in simple spaceTrim tests.
Nesting
This is very usefull when you want to trim multiline strings inside multiline strings.
import { spaceTrim } from 'spacetrim';
const trimmed = spaceTrim(
(block) => `
Numbers
${block(['1', '2', '3'].join('\n'))}
Chars
${block(['A', 'B', 'C'].join('\n'))}
`,
);
console.log(trimmed);
See more examples in nesting tests.
🖋️ Contributing
I am opened to pull requests, feedback and suggestions. Or if you like this utility, you can ☕ buy me a coffee or donate via cryptocurrencies
✨ Partners
Become a partner