parse-values
v1.1.0
Published
parse a string of values with separators, quotes and escape, and returns an array
Downloads
1
Readme
parse-values
parse a string of values with separators, quotes and escape, and returns an array
Install
npm install --save parse-values
Usage: parseValues(text: string, firstPotentialSeparators: ?Array, includeFirstSeparator: boolean)
import parseValues from 'parse-values';
console.log(parseValues('test test 2')); // ['test', 'test', '2']
console.log(parseValues('test, test 2')); // ['test', 'test2']
console.log(parseValues('"test", "test \" 2"')); // ['test', 'test " 2']
// with first separator
console.log(parseValues('title ? test test2', ['?'])); // ['title', 'test', 'test2']
console.log(parseValues('title ? test test2', ['?'], true)); // ['title ?', 'test', 'test2']
console.log(parseValues('"title" test test2', ['?'])); // ['title', 'test', 'test2']