parse-numeric-range
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -8,3 +8,3 @@ function parsePart(str) { | ||
// 1-5 or 1..5 (equivilant) or 1...5 (doesn't include 5) | ||
if((m = str.match(/^(-?\d+)(-|\.\.\.?)(-?\d+)$/))) { | ||
if((m = str.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/))) { | ||
var lhs = m[1]; | ||
@@ -20,3 +20,3 @@ var sep = m[2]; | ||
// Make it inclusive by moving the right 'stop-point' away by one. | ||
if(sep == '-' || sep == '..') { | ||
if(sep == '-' || sep == '..' || sep == '\u2025') { | ||
rhs += incr; | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "parse-numeric-range", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Takes a string, such as \"1,2,3-10,5-8\" and turns it into an array of numbers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
node-parse-numeric-range | ||
======================== | ||
Parses expressions like 1-10,20-30. Returns an energetic array. | ||
Parses expressions like 1-10,20-30. Returns an energetic (as opposed to lazy) array. | ||
@@ -18,2 +18,3 @@ | ||
| -1-2,-2 |[-1,0,1,2,-2] | | ||
| -1--2 |[-1,-2] | | ||
| -1..2,-2 |[-1,0,1,2,-2] | | ||
@@ -20,0 +21,0 @@ | -1...3,-2 |[-1,0,1,2,-2] | |
@@ -46,3 +46,12 @@ var expect = require('chai').expect; | ||
}); | ||
it('should parse 1‥3', function() { | ||
peq('1‥3', [1,2,3]); | ||
}); | ||
it('should parse 1⋯3', function() { | ||
peq('1⋯3', [1,2]); | ||
}); | ||
it('should parse 1…3', function() { | ||
peq('1…3', [1,2]); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5488
98
38