parse-values

1.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i parse-values

Weekly Downloads

0

Version

1.1.0

License

ISC

Last publish

Collaborators

  • churpeau