resolve-indent
v0.1.0
Published
Split code block by indent
Downloads
8
Readme
resolve-indent
Split code block by indent.
Installation
npm i -S resolve-indent
Example
You have a source file:
import re
for test_string in ['555-1212', 'ILL-EGAL']:
if re.match(r'^\d{3}-\d{4}$', test_string):
print test_string, 'is a valid US local phone number'
else:
print test_string, 'rejected'
parents, babies = (1, 1)
while babies < 100:
print 'This generation has {0} babies'.format(babies)
parents, babies = (babies, parents + babies)
You compile the code:
import resolveIndent from 'indent-resolve'
resolveIndent(code)
You got the output:
[
"import re",
"for test_string in ['555-1212', 'ILL-EGAL']:\n if re.match(r'^d{3}-d{4}$', test_string):\n print test_string, 'is a valid US local phone number'\n else:\n print test_string, 'rejected'\",
"parents, babies = (1, 1)",
"while babies < 100:\n print 'This generation has {0} babies'.format(babies)\n parents, babies = (babies, parents + babies)"
]
License
MIT © EGOIST