@pied-piper-inc/fib-tools

1.0.1632228778 • Public • Published

@pied-piper-inc/fib-tools

This module provides helper functions for the Fibonacci sequence.

Get the nth Number

const {getNumber} = require('@bbq-beets/fib-tools')
assert.strictEqual(getNumber(8), 21)

Get a List of Numbers

const {getList} = require('@bbq-beets/fib-tools')
assert.strictDeepEqual(getList(8), [0, 1, 1, 2, 3, 5, 8, 13, 21])

Get a Sequence of Numbers

const {getSequence} = require('@bbq-beets/fib-tools')

const seq = getSequence()

for (const n of seq) {
  console.log(n) // The next Fibonacci number in the sequence
}

test

Readme

Keywords

none

Package Sidebar

Install

npm i @pied-piper-inc/fib-tools

Weekly Downloads

0

Version

1.0.1632228778

License

MIT

Unpacked Size

3.29 kB

Total Files

4

Last publish

Collaborators

  • chrispat