# time-overlap

> This module provides several useful functions to calculate timestamps(enter-exit,array-format) overlapping

Latest version **2.1.1** (published 2020-06-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install time-overlap
pnpm add time-overlap
yarn add time-overlap
bun add time-overlap
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2020-06-15 |
| First published | 2016-12-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 51.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | JurungPark |
| Maintainers | jurungpark |
| Keywords | timestamp, calculate overlap, open close, enter exit |

## Links

- npm: https://www.npmjs.com/package/time-overlap
- Repository: https://github.com/parkjurung/time-overlap
- Homepage: https://github.com/parkjurung/time-overlap#readme
- Issues: https://github.com/parkjurung/time-overlap/issues
- npm.io page: https://npm.io/package/time-overlap

## Recent versions

- 2.1.1 (latest) — 2020-06-15
- 2.1.0 — 2020-05-02
- 2.0.0 — 2020-05-02
- 1.2.1 — 2018-11-20
- 1.2.0 — 2018-11-20
- 1.1.6 — 2018-08-20
- 1.1.5 — 2017-01-16
- 1.1.4 — 2017-01-12
- 1.1.3 — 2017-01-11
- 1.1.2 — 2017-01-11
- 1.1.1 — 2017-01-11
- 1.1.0 — 2017-01-10
- 1.0.2 — 2017-01-10
- 1.0.1 — 2017-01-10
- 1.0.0 — 2016-12-14

## README

This module provides several useful functions to calculate timestamps(enter-exit,array-format) overlapping
 
#install
```
npm install time-overlap
```
#test
```
npm test
```
#usage
```javascript
var timeOverlap = require('time-overlap');

timeOverlap.cross([1,3,5,7],[2,4,6,8]); // return [2,3,6,7]

// --1--2--3--4--5--6--7--8--9--        //
//   1-----3     5-----7                //arg0
//      2-----4     6-----8             //arg1 
//==============================
//      2--3        6--7                //result

timeOverlap.sum([1,3,5,7],[2,4,6,8]);   //return [1,4,5,8]

// --1--2--3--4--5--6--7--8--9--        //
//   1-----3     5-----7                //arg0
//      2-----4     6-----8             //arg1 
//==============================
//   1--------4  5--------8            //result

timeOverlap.crossAll(); 
//same as cross(), but can receive multiple operand
timeOverlap.sumAll(); 
//same as sum(), but can receive multiple operand

timeOverlap.integrate([1,2,3,4,5,7]);   // return 4
// --1--2--3--4--5--6--7--8--9--
//   1--2  3--4  5-----7
//=============================
//   1+    1+    2              = 4
```

#other examples
```
<CROSS>
--1--2--3--4--5--6--7--8--9--  //
  1-----3  4-----6             //arg0 [1,3,4,6]
        3--4  5--------8       //arg1 [3,4,5,8]
=============================        
        3  4  5--6             //result [3,3,4,4,5,6]
        
        
--1--2--3--4--5--6--7--8--9--  //
  1-----3        6-----------  //arg0 [1,3,6] 
     2--------------7          //arg1 [2,7]
  1--2        5--------8       //arg2 [1,2,5,8]
=============================        
     2           6--7          //result [2,2,6,7]
     
<SUM>
--1--2--3--4--5--6--7--8--9--  //
  1-----3  4-----6     8-----  //arg0 [1,3,4,6,8]
        3--4  5-----------9    //arg1 [3,4,5,9]
=============================        
  1-----3--4-----------------  //result [1,3,3,4,4]   

```

---
_Source: https://npm.io/package/time-overlap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
