range-selection-parser

0.0.1 • Public • Published

range-selection-parser

Node.js module to parse range selection strings, for example '2, 5, 7-9'.

Installation:

npm install range-selection-parser

Usage:

var parser = require('range-selection-parser');

parser.parseSelectionString('3, 6-9');
  // => [3, 6, 7, 8, 9]

parser.selectFromArray(['a', 'b', 'c', 'd', 'e'], '1-3, 5');
  // => ['a', 'b', 'c', 'e']

parser.selectFromArray(['aa', 'bb', 'cc', 'dd'], '2-');
  // => ['bb', 'cc', 'dd']

Parser is very forgiving:

parser.parseSelectionString(' 0 ,  5- 9 13');
  // => [0, 5, 6, 7, 8, 9, 13]

Tests (jasmine-node must be installed):

jasmine-node test

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.10latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.10

Package Sidebar

Install

npm i range-selection-parser

Weekly Downloads

0

Version

0.0.1

License

BSD

Last publish

Collaborators

  • espesen