@affrae/fib-tools

1.1.4 • Public • Published

@affrae/fib-tools

Total alerts Language grade: JavaScript Mark stale issues and pull requests

This module provides helper functions for the Fibonacci sequence.

Get the nth Number

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

Get a List of Numbers

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

Get a Sequence of Numbers

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

const seq = getSequence()

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

Acknowledgements

This is openly and heavily borrowed from Jonathan Clem's fib-tools project, and he is listed as copyright owner in the MIT License. I used this to teach myself LGTM and QL GitHub Advanced Security, along with GitHub Actions

License

The scripts and documentation in this project are released under the MIT License

Dependencies (2)

Dev Dependencies (1)

Package Sidebar

Install

npm i @affrae/fib-tools

Weekly Downloads

2

Version

1.1.4

License

MIT

Unpacked Size

4.2 kB

Total Files

4

Last publish

Collaborators

  • affrae