aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/unitsToRanges.js3
-rw-r--r--test/unitsToRanges.js6
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/unitsToRanges.js b/lib/unitsToRanges.js
index 764d8f2..ecd3c96 100644
--- a/lib/unitsToRanges.js
+++ b/lib/unitsToRanges.js
@@ -37,7 +37,7 @@ module.exports = (units, sourceAddresses) => {
acc.push(cur)
}
} else if (rangeParts.length > 2) {
- // 1-2-3 not sure if this ever occures, but just pass as is
+ // 1-2-3 not sure if this ever occurs, but just pass as is
console.log(`Unsupported range ${cur}`)
if (sourceAddresses) {
console.log(JSON.stringify(sourceAddresses, null, 2))
@@ -75,6 +75,7 @@ module.exports = (units, sourceAddresses) => {
if (sourceAddresses) {
console.log(JSON.stringify(sourceAddresses, null, 2))
}
+ acc.push([cur])
return acc
}
diff --git a/test/unitsToRanges.js b/test/unitsToRanges.js
index 0908b1e..ccb583b 100644
--- a/test/unitsToRanges.js
+++ b/test/unitsToRanges.js
@@ -100,6 +100,12 @@ test('units list to addr:flats', t => {
)
t.same(
+ unitsToRanges(['1', 'G0 1', '2', '3']),
+ '1-3;G0 1',
+ 'some units unable to parse as prefix number postfix should still be listed'
+ )
+
+ t.same(
unitsToRanges('2,15,3,12,1,9,19,1C,1A,6,14,16,5,5-6,A,B,C,4,17-18,7-8'.split(',')),
'1-9;12;14-19;1A;1C;A;B;C',
'complex real world data'