Miss any of our Open RFC calls?Watch the recordings here! »

resolve-indent

0.1.0 • Public • Published

resolve-indent

NPM version NPM download Build Status: Linux

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'
parentsbabies = (11)
while babies < 100:
    print 'This generation has {0} babies'.format(babies)
    parentsbabies = (babiesparents + 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

Install

npm i resolve-indent

DownloadsWeekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • avatar