Skip to main content

Fibonacci

GitMoji License: MIT Lines Of Code CodeQL

Port of fibonacci-go for Deno.

Utilities for the Fibonacci Number and Sequence.

You can get this package by nest.land or deno.land.

Usage

This package exposes two Functions, fibonacci and fibonacciSequence.

import fibonacci, {
  fibonacciSequence,
} from "https://deno.land/x/fibonacci/mod.ts";

console.log(fibonacci(9)); // 34
console.log(fibonacciSequence(4)); // [ 0, 1, 1, 2]

CLI Tool

This project contains a cli tool, it is made to give an example of use mainly.

Install it

deno install https://deno.land/x/fibonacci/cli.ts

For more info check this.

Usage

  • If you just run the command, it will print all the commands available:
$ fibonacci

Options:
  --number    Print the Nth Fibonacci Number
  --sequence  Print an array with the first N numbers in the Fibonacci sequence
  • Get the Nth Fibonacci Number:
$ fibonacci --number 3
2
  • Get an Array with the first N numbers of the Fibonacci Sequence:
$ fibonacci --sequence 3
[ 0, 1, 1 ]

License

This package is licensed under the MIT License.