merge-timerange
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -202,3 +202,4 @@ 'use strict'; | ||
// sum: [String] | ||
// } | ||
// }, | ||
// nosort: Boolean | ||
// } | ||
@@ -244,5 +245,9 @@ S.normalize = (arg) => spawn(function*() { | ||
let source = byAll[key]; | ||
if (!arg.nosort) source.sort((a, b) => a.start - b.start); | ||
S.mergeTimeranges({ | ||
maxInterval: arg.maxInterval, | ||
from: byAll[key], | ||
from: source, | ||
to: result, | ||
@@ -249,0 +254,0 @@ prop: arg.prop, |
{ | ||
"name": "merge-timerange", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Merge time ranges", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,2 +14,8 @@ 'use strict'; | ||
head: 1, | ||
start: new Date('2015-01-01T12:00:00Z'), | ||
end: new Date('2015-01-01T13:00:00Z'), | ||
prop: 'a', | ||
sums: {a: 20} | ||
}, { | ||
head: 1, | ||
start: new Date('2015-01-01T10:00:00Z'), | ||
@@ -21,8 +27,2 @@ end: new Date('2015-01-01T11:00:00Z'), | ||
head: 1, | ||
start: new Date('2015-01-01T12:00:00Z'), | ||
end: new Date('2015-01-01T13:00:00Z'), | ||
prop: 'a', | ||
sums: {a: 20} | ||
}, { | ||
head: 1, | ||
start: new Date('2015-01-01T14:00:00Z'), | ||
@@ -29,0 +29,0 @@ end: new Date('2015-01-01T15:00:00Z'), |
@@ -69,3 +69,3 @@ 'use strict'; | ||
merge1.inserts [test]('merged rangeItems should match', [ | ||
merge1.inserts [test]('merged inserts should match', [ | ||
{ | ||
@@ -90,5 +90,11 @@ time: 10800, | ||
merge1.removes [test]('should merge into free ranges (default)', [ | ||
merge1.removes [test]('merged removes should match', [ | ||
{ | ||
head: 1, | ||
start: new Date('2015-01-01T12:00:00Z'), | ||
end: new Date('2015-01-01T13:00:00Z'), | ||
prop: 'a', | ||
sums: {a: 20} | ||
}, { | ||
head: 1, | ||
start: new Date('2015-01-01T10:00:00Z'), | ||
@@ -100,8 +106,2 @@ end: new Date('2015-01-01T11:00:00Z'), | ||
head: 1, | ||
start: new Date('2015-01-01T12:00:00Z'), | ||
end: new Date('2015-01-01T13:00:00Z'), | ||
prop: 'a', | ||
sums: {a: 20} | ||
}, { | ||
head: 1, | ||
start: new Date('2015-01-01T16:00:00Z'), | ||
@@ -114,5 +114,9 @@ end: new Date('2015-01-01T17:00:00Z'), | ||
merge1.removeCmds [test]('should merge into free ranges (default)', [ | ||
merge1.removeCmds [test]('merged removeCmds should match', [ | ||
{ | ||
head: 1, | ||
start: new Date('2015-01-01T12:00:00Z'), | ||
end: new Date('2015-01-01T13:00:00Z') | ||
}, { | ||
head: 1, | ||
start: new Date('2015-01-01T10:00:00Z'), | ||
@@ -122,6 +126,2 @@ end: new Date('2015-01-01T11:00:00Z') | ||
head: 1, | ||
start: new Date('2015-01-01T12:00:00Z'), | ||
end: new Date('2015-01-01T13:00:00Z') | ||
}, { | ||
head: 1, | ||
start: new Date('2015-01-01T16:00:00Z'), | ||
@@ -128,0 +128,0 @@ end: new Date('2015-01-01T17:00:00Z') |
@@ -24,3 +24,3 @@ 'use strict'; | ||
merge2.removesShouldBe = T.from1.slice(1).concat(undefined); | ||
merge2.removesShouldBe = T.from1.slice(0, 1).concat(T.from1.slice(2)).concat(undefined); | ||
merge2.removes [test]('merged removes should match', merge2.removesShouldBe); | ||
@@ -37,3 +37,3 @@ | ||
T.Model.collection.insert = (items, cb) => { | ||
items [test]('merged rangeItems should match', merge2.insertsShouldBe); | ||
items [test]('Model.collection.insert arguments should match', merge2.insertsShouldBe); | ||
cb(null, {}); | ||
@@ -43,3 +43,3 @@ }; | ||
T.Model.remove = (items) => new Promise((resolve) => { | ||
items [test]('should merge into free ranges (default)', {$or: merge2.removeCmdsShouldBe}); | ||
items [test]('Model.remove arguments should match', {$or: merge2.removeCmdsShouldBe}); | ||
resolve({}); | ||
@@ -46,0 +46,0 @@ }); |
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
21190
597