resolve-indent
Split code block by indent.
Installation
npm i -S resolve-indent
Example
You have a source file:
import refor test_string in : if : 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'. parents, babies = (babies, parents + babies)
You compile the 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