parse-values

parse a string of values with separators, quotes and escape, and returns an array


License
ISC
Install
npm install parse-values@1.1.0

Documentation

parse-values NPM version

parse a string of values with separators, quotes and escape, and returns an array

Build StatusTravis StatusDependency Status Coverage percentage

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