mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
add spec helpers
This commit is contained in:
parent
c73762e00e
commit
f92e046d13
9
spec/helpers.moon
Normal file
9
spec/helpers.moon
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
-- 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 }
|
Loading…
Reference in New Issue
Block a user