1.1.0 • Published 8 years ago

parse-values v1.1.0

Weekly downloads
16
License
ISC
Repository
github
Last release
8 years ago

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