angular-range-selection-parser

AngularJS module to parse range selection strings from user input
Homepage:
0 people use it
Author: Assets.github.com%2fimages%2fgravatars%2fgravatar-user-420 Espesen
Submitted by: Assets.github.com%2fimages%2fgravatars%2fgravatar-user-420 Espesen

range-selection-parser

AngularJS module to parse range selection strings from user input, for example '2, 5, 7-9'.

Example:

See working example at http://bit.ly/190R2pJ

Usage:

// Inject service rangeSelectionParser to your controller rangeSelectionParser.parseSelectionString('3, 6-9'); // => [3, 6, 7, 8, 9]

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

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

// Parser is very forgiving: rangeSelectionParser.parseSelectionString(' 0 , 5- 9 13'); // => [0, 5, 6, 7, 8, 9, 13]

Testing

Run tests on command line with Karma: karma start

comments powered by Disqus
This page was last updated over 4 years ago.