split-string
Split a string on a character except when the character is escaped.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.
Install
Install with npm:
Usage
Brackets
Also respects brackets unless disabled:
Options
options.brackets
Type: object|boolean
Default: undefined
Description
If enabled, split-string will not split inside brackets. The following brackets types are supported when options.brackets
is true
,
Or, if object of brackets must be passed, each property on the object must be a bracket type, where the property key is the opening delimiter and property value is the closing delimiter.
Examples
options.sep
Type: string
Default: .
The separator/character to split on.
Example
options.keepEscaping
Type: boolean
Default: undefined
Keep backslashes in the result.
Example
options.keepQuotes
Type: boolean
Default: undefined
Keep single- or double-quotes in the result.
Example
options.keepDoubleQuotes
Type: boolean
Default: undefined
Keep double-quotes in the result.
Example
options.keepSingleQuotes
Type: boolean
Default: undefined
Keep single-quotes in the result.
Example
Customizer
Type: function
Default: undefined
Pass a function as the last argument to customize how tokens are added to the array.
Example
Properties
The tok
object has the following properties:
tok.val
(string) The current value about to be pushed onto the result arraytok.idx
(number) the current index in the stringtok.str
(string) the entire stringtok.arr
(array) the result array
Release history
v3.0.0 - 2017-06-17
Added
adds support for brackets
About
Related projects
You might also be interested in these projects:
deromanize: Convert roman numerals to arabic numbers (useful for books, outlines, documentation, slide decks, etc) | homepage
randomatic: Generate randomized strings of a specified length using simple character sequences. The original generate-password. | homepage
repeat-string: Repeat the given string n times. Fastest implementation for repeating a string. | homepage
Contributors
Author
Jon Schlinkert
License
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on November 19, 2017.
Last updated