comma-split
Split comma delimited strings into an array. Optional handling for trailing and/or leading whitespace.
Installation
npm install --save comma-split
Usage
var commaSplit = ; ;// => ['some','string','delimited','by','commas'] ;// => ['some',' string','\r\r\n\tdelimited\n','by',' commas'] ;// => ['some','string','delimited\n','by','commas'] ;// => ['some',' string','\r\r\n\tdelimited','by',' commas'] ;// => ['','','some','string','delimited','by','commas',''] ;// => [some','string','delimited','by','commas'] ;// => [some','string','with', 'a', 'dupe'']
Options
ignoreWhitespace
:boolean
- Ignore leading and trailing whitespace.ignoreTrailingWhitespace
:boolean
- Ignore trailing whitespace.ignoreLeadingWhitespace
:boolean
- Ignore leading whitespace.ignoreDuplicate
:boolean
- Ignore duplicate elements.
License
MIT
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Crafted with <3 by John Otander (@4lpine).
This package was initially generated with yeoman and the p generator.