# fib

> Fibonacci sequence

Latest version **0.0.1** (published 2015-06-18) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2015-06-18 |
| First published | 2015-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | fluffybunnies |
| Maintainers | fluffybunnies |
| Keywords | fibonacci, sequence, natural, decay |

## Links

- npm: https://www.npmjs.com/package/fib
- Repository: git@github.com:fluffybunnies/fib
- Homepage: https://github.com/fluffybunnies/fib
- Issues: https://github.com/fluffybunnies/fib/issues
- npm.io page: https://npm.io/package/fib

## Recent versions

- 0.0.1 (latest) — 2015-06-18

## README

[![Build Status](https://secure.travis-ci.org/fluffybunnies/fib.png)](http://travis-ci.org/fluffybunnies/fib)

# fib

Returns the fibonacci number at position `n`


### Api

#### fib( n [, zeroOffset] )


### Example
Traditional pattern
<br />1, 1, 2, 3, 5, 8,13, 21, 34, 55, 89, 144, ...
```javascript
var fib = require('fib')

fib(0) // 1
fib(1) // 1
fib(2) // 2
fib(3) // 3
fib(4) // 5
fib(50) // 20365011074
```


### Example - zeroOffset = 1
Common modern use case
<br />0, 1, 1, 2, 3, 5, 8,13, 21, 34, 55, 89, ...
```javascript
var fib = require('fib')

fib(0, 1) // 0
fib(1, 1) // 1
fib(2, 1) // 1
fib(3, 1) // 2
fib(4, 1) // 3
fib(50, 1) // 12586269025
```


### Example - zeroOffset = x
Use case: Delay sequence start for x `n`
<br />[0 if `n`-`zeroOffset` < 0 ...], 1, 1, 2, 3, 5, 8,13, 21, 34, 55, 89, ...
```javascript
var fib = require('fib')

function lostConnection(){
	var checkDelay = 15, checkDelayDecayAt = 100, checkCount = 0;
	(function checkForConnection(){
		if (haveConnection())
			return resumeApp()
		setTimeout( checkForConnection, checkDelay * fib(++checkCount, checkDelayDecayAt) )
	}());
}
```

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