Template String Utilities
deindent
Strips indentation based on the indentation found on the first line. Will leave extra newlines and extra indentation intact. It will however remove leading and trailing line breaks.
; console; // => "foo bar\nqux baz" console; // => "foo bar\n qux baz" console; // => "foo bar\n\n qux baz"
Can be used as a regular function as well as a tag for template strings:
console; // => "foo bar\nqux baz" console; // => "foo bar\nqux baz"
Can also be required directly:
;
collapse
Collapses whitespace in a line wrapped over multiple lines.
; console; // => "foo bar qux baz" console; // => "foo bar qux baz" console;// => "This is a very long string that I rather not have to put in a single " +// "line because then it would make my code spill over and take more " +// "than the 80 characters per line that I prefer."
Can also be required directly:
;
reflow
Strips indentation as deindent, but will persist paragraphs (separated by double newlines like in markdown) and reflow the paragraphs so that they fit within a defined width.
; console; // => "foo bar\nqux baz\nfoo bar" console; // => "foo bar\n\nqux baz" console;/* => This is a very long string that is for sure longer than 30 characters. This is a very long string that is for sure longer than 30 characters. */
It also supports being called as a regular non-template-string function:
;
Can also be required directly:
;
qw
A qw (quote word) helper for old, disgruntled perl programmers.
; const blah = "hey"; console; // => [ 'foo', 'bar', 'quux', 'hey', 'baz' ]
Can also be imported directly:
;