You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

interval-management

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interval-management - npm Package Compare versions

Comparing version
3.0.0
to
3.0.1
+1
-1
package.json
{
"name": "interval-management",
"version": "3.0.0",
"version": "3.0.1",
"description": "No dependency interval management library, able to work with numbers, string, Dates or special objects",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,4 +26,4 @@ # Intervals documentation

expect(interval(2, 10).diff(interval(5, 10))[0].array()).toEqual([2, 3, 4, 5]);
expect(interval(2, 4).diff(interval(5, 10))[0].array()).toEqual([2, 3, 4]);
expect(interval(2, 10).diff(interval(5, 10))?.array()).toEqual([2, 3, 4, 5]);
expect(interval(2, 4).diff(interval(5, 10))?.array()).toEqual([2, 3, 4]);

@@ -42,4 +42,4 @@ expect(interval(2, 5).overlap(interval(5, 6))).toBe(true);

expect(interval(date5, date7, byHour).concat(interval(date6, date8, byHour))[0].array()).toEqual([date5, date6, date7, date8]);
expect(interval(date5, date6, byHour).concat(interval(date6, date7, byHour))[0].array()).toEqual([date5, date6, date7]);
expect(interval(date5, date7, byHour).concat(interval(date6, date8, byHour))?.array()).toEqual([date5, date6, date7, date8]);
expect(interval(date5, date6, byHour).concat(interval(date6, date7, byHour))?.array()).toEqual([date5, date6, date7]);

@@ -54,7 +54,7 @@ ```

Another important feature is the Comparable interface. If you need a custom object iterated over, you can do it like this:
Another important feature is the custom comparing functions for object intervals
```typescript
class TestData implements Comparable<TestData> {
class TestData {
public date: Date;

@@ -64,4 +64,2 @@ constructor(date: Date) {

}
public isLessThan = (test: TestData) => this.date.getTime() < test.date.getTime();
public equals = (test: TestData) => this.date.getTime() === test.date.getTime();
public byHour = () => new TestData(this.byHourImpl(this.date));

@@ -75,2 +73,7 @@ private byHourImpl = (date: Date) => {

const compare = (a: TestData, b: TestData) => a.date.getTime() - b.date.getTime();
const i = interval(comparable1, comparable2, byHour, compare);
expect(i.array()).dateEqual((i.copy().array() as TestData[]));
```

@@ -77,0 +80,0 @@