resolve-indent
Split code block by indent
Last updated 5 years ago by kchan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install resolve-indent 
SYNC missed versions from official npm registry.

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'
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

Current Tags

  • 0.1.0                                ...           latest (5 years ago)

1 Versions

  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |