moonscript/spec/helpers.moon

10 lines
229 B
Plaintext
Raw Normal View History

2014-06-07 07:04:26 +00:00
-- remove front indentation from a multiline string, making it suitable to be
-- parsed
unindent = (str) ->
indent = str\match "^%s+"
return str unless indent
(str\gsub("\n#{indent}", "\n")\gsub "%s+$", "")
{ :unindent }