intervals-fn
Advanced tools
Comparing version 2.8.3 to 2.8.4
@@ -347,2 +347,3 @@ "use strict"; | ||
}; | ||
const sortNumbers = (arr) => [...arr].sort((a, b) => a - b); | ||
const splitCurry = (splitIndexes, intervals) => { | ||
@@ -354,3 +355,3 @@ const typeStr = getType(intervals); | ||
} | ||
return splitGen([...splitIndexes].sort(), intervalSE).map(convertTo(typeStr)); | ||
return splitGen(sortNumbers(splitIndexes), intervalSE).map(convertTo(typeStr)); | ||
}; | ||
@@ -357,0 +358,0 @@ function split(splitIndexes, interv) { |
@@ -417,9 +417,9 @@ "use strict"; | ||
ava_1.default('will split with multiple indexes', t => { | ||
const r1 = [{ start: 0, end: 10, test: 'foo' }]; | ||
const r2 = [2, 8]; | ||
const r1 = [{ start: 0, end: 15, test: 'foo' }]; | ||
const r2 = [5, 11]; | ||
const res = lib_1.split(r2, r1); | ||
t.is(res.length, 3); | ||
testInterval(t, res[0], [0, 2], { test: 'foo' }); | ||
testInterval(t, res[1], [2, 8], { test: 'foo' }); | ||
testInterval(t, res[2], [8, 10], { test: 'foo' }); | ||
testInterval(t, res[0], [0, 5], { test: 'foo' }); | ||
testInterval(t, res[1], [5, 11], { test: 'foo' }); | ||
testInterval(t, res[2], [11, 15], { test: 'foo' }); | ||
}); |
@@ -331,2 +331,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
}; | ||
const sortNumbers = (arr) => [...arr].sort((a, b) => a - b); | ||
const splitCurry = (splitIndexes, intervals) => { | ||
@@ -338,3 +339,3 @@ const typeStr = getType(intervals); | ||
} | ||
return splitGen([...splitIndexes].sort(), intervalSE).map(convertTo(typeStr)); | ||
return splitGen(sortNumbers(splitIndexes), intervalSE).map(convertTo(typeStr)); | ||
}; | ||
@@ -341,0 +342,0 @@ export function split(splitIndexes, interv) { |
@@ -415,9 +415,9 @@ import test from 'ava'; | ||
test('will split with multiple indexes', t => { | ||
const r1 = [{ start: 0, end: 10, test: 'foo' }]; | ||
const r2 = [2, 8]; | ||
const r1 = [{ start: 0, end: 15, test: 'foo' }]; | ||
const r2 = [5, 11]; | ||
const res = split(r2, r1); | ||
t.is(res.length, 3); | ||
testInterval(t, res[0], [0, 2], { test: 'foo' }); | ||
testInterval(t, res[1], [2, 8], { test: 'foo' }); | ||
testInterval(t, res[2], [8, 10], { test: 'foo' }); | ||
testInterval(t, res[0], [0, 5], { test: 'foo' }); | ||
testInterval(t, res[1], [5, 11], { test: 'foo' }); | ||
testInterval(t, res[2], [11, 15], { test: 'foo' }); | ||
}); |
{ | ||
"name": "intervals-fn", | ||
"version": "2.8.3", | ||
"version": "2.8.4", | ||
"description": "Manipulate intervals in a functional way", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib.js", |
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
90786
2102