Skip to content

Commit

Permalink
release version 1.0.0 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
lezram authored Mar 22, 2020
1 parent 0117d42 commit baf5d8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ console.log(timeInterval);

## API

* `new Interval(start: number, end: number, includeStart: boolean, includeEnd: boolean)`
* `new Interval(start: number, end: number, includeStart: boolean, includeEnd: boolean)` \
Create an interval object
```typescript
new Interval(1, 2, true, false);
```
* `Interval.from(intervalNotation: string): Interval`
* `Interval.from(intervalNotation: string): Interval` \
Create an interval object from mathematical interval notation
```typescript
Interval.from("[1,2]");
```
* `Interval.sort(interval1, interval2, ...): Interval[]`
* `Interval.sort(interval1, interval2, ...): Interval[]` \
Sort intervals with following order: empty, lowest start, lowest end
* `Interval.union(interval1, interval2, ...): Interval[]`
* `Interval.union(interval1, interval2, ...): Interval[]` \
Union elements and sort
```typescript
const interval1 = new Interval(1, 2, true, true);
Expand All @@ -59,13 +59,19 @@ console.log(timeInterval);
const union = Interval.union(interval1, interval2);
// union = new Interval(1, 4, true, false);
```
* `obj.isOverlapping(interval: Interval): boolean`
* `obj.isOverlapping(interval: Interval): boolean` \
Checks if passed interval overlaps/intersect
* `obj.contains(numberOrInterval: number | Interval): boolean`
* `obj.contains(numberOrInterval: number | Interval): boolean` \
Contains passed number or interval completely
* `obj.isEmpty(): boolean`
* `obj.isEmpty(): boolean` \
If is an empty interval `{}`, `[2,1]`, `(1,1)`, `(1,1]`, `[1,1)`
* `obj.copy(): Interval`
* `obj.copy(): Interval` \
Copy interval
* `obj.isEqual(interval: Interval): boolean`
* `obj.isEqual(interval: Interval): boolean` \
Check if interval is equal

## Similar libraries
* [math.interval](https://github.com/xgbuils/math.interval)
* [math-intervals](https://github.com/pifactory/math-intervals)
* [math-interval](https://github.com/harunurhan/math-interval)
* [math-interval-parser](https://github.com/Semigradsky/math-interval-parser)
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "@lezram/math-interval",
"version": "0.0.5",
"version": "1.0.0",
"description": "Working with mathematical intervals",
"main": "dist/node/index.js",
"types": "dist/node/index.d.ts",
"scripts": {
"build": "npm run build:node && npm run build:browser",
"build:node": "tsc",
"build:browser": "webpack",
"ci": "npm run test-build & npm t & wait",
"prepublishOnly": "npm run ci",
"test": "jest",
"ci": "npm run test-build & npm run coverage & wait",
"test-build": "npm run build && node e2e/test-build.js",
"test": "jest",
"coverage": "jest --coverage"
},
"repository": {
Expand Down

0 comments on commit baf5d8f

Please sign in to comment.