# segflip

> Flip the Inside and Outside of Segments on a Single-Dimensional Integer Line

Latest version **0.0.2** (published 2022-04-17) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install segflip
pnpm add segflip
yarn add segflip
bun add segflip
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2022-04-17 |
| First published | 2022-03-20 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Daniel J. Dufour |
| Maintainers | danieljdufour |
| Keywords | integer, line, math, segments |

## Links

- npm: https://www.npmjs.com/package/segflip
- Repository: https://github.com/DanielJDufour/segflip
- Homepage: https://github.com/DanielJDufour/segflip#readme
- Issues: https://github.com/DanielJDufour/segflip/issues
- npm.io page: https://npm.io/package/segflip

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2022-04-17
- 0.0.1 — 2022-03-20

## README

# segflip
Flip the Inside and Outside of Segments on a Single-Dimensional Integer Line

# install
### command line
```bash
npm install segflip
```
### browser
```html
<script src="https://unpkg.com/segflip"></script>
```

# usage
```js
import segflip from "segflip";

// 21st century recessions in the United States
// from https://en.wikipedia.org/wiki/List_of_recessions_in_the_United_States
const recessions = [
  [2001, 2001], // Early 2000s recession
  [2007, 2009], // Great Recession
  [2020, 2020] // COVID-19 recession
];

const results = segflip({
  segments: recessions,
  
  // smallest possible integer
  // default is -Infinity
  min: 2000,
  
  // largest possible integer
  // default is Infinity
  max: 2022
});
```
results is an array of year ranges when there wasn't a recession
```js
[
  [2000, 2000],
  [2002, 2006],
  [2010, 2019],
  [2021, 2022]
]
```

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