Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fibonacci-generator-function

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fibonacci-generator-function

Generator function yielding the next number in a fibonacci sequence. Optional starting param.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Fibonacci Generator Function - JavaScript

Generator function yielding the next number in a fibonacci sequence. Optional starting param.

Installation

npm install fibonacci-generator-function

// Node.JS
const {fibGen} = require('fibonacci-generator-function');

// ES2015+
import {fibGen} from 'fibonacci-generator-function';

Usage

const fib = fibGen(); // Default sequence start of 1
const fib3 = fibGen(3); // Start sequence at 3

console.log( fib1.next() ); // { value: 1, done: false }
console.log( fib1.next() ); // { value: 2, done: false }
console.log( fib1.next().value ); // 3
console.log( fib1.next().value ); // 5
console.log( fib1.next().value ); // 8
// etc...

console.log( fib3.next() ); // { value: 3, done: false }
console.log( fib3.next() ); // { value: 6, done: false }
console.log( fib3.next().value ); // 9
console.log( fib3.next().value ); // 15
console.log( fib3.next().value ); // 24
// etc...

Keywords

FAQs

Package last updated on 05 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc