string-indent
Easy way to get the indent of a string, whether file content or simple string.
Table of contents
Installation
$ npm install string-indent
Easy, or?
Usage
const stringIndent = ; // simplelet simpleIndent = ; // simpleIndent = 2 // multilinelet multilineIndent = ; // multilineIndent = [3, 2]
API
stringIndent(string, options)
Returns a single indent value or an array of indents (if multiline option is activated).
string
String - String to get the indent(s) of.options
Object (optional)multiline
Boolean - Iftrue
, the script will look for multiple lines and returns an array instead of a single indent value.
Development
In the test
directory are a few test.*
files. Be careful, if you´ll
open them in your editor or IDE. The indents could be changed through settings of
those.
Run test:
$ npm test
Changelog
- 0.1.2
- Update dependencies
- 0.1.1
- Some comment improvements and warnings
- 0.1.0
- Initial Release