Coder Social home page Coder Social logo

fizzbuzz's Introduction

The ultimate FizzBuzz.

Never write the same line again.

Example usage:

fizzBuzz(i => i < 100, {3: "Fizz", 5: "Buzz"})

Goes through all of the numbers from 0 (default start) until the first argument returns false (100). Uses the second argument to determine the resulting FizzBuzz string.

ULTIMATE CUSTOMIZABILITY.

Advanced usage:

fizzBuzz(
    i => i < 1000,
    {7: "God", 9: "Is", 11: "Dead"},
    i => i + 2,
    -50
);

ULTIMATE CUSTOMIZATION.

Documentation

  • Note: Full documentation is in the docs/ folder in the package.

Interfaces

FizzBuzzNumbersMap

Maps numbers to their corresponding FizzBuzz string.

Ex:

{
     3: "Fizz",
     5: "Buzz"
}

Hierarchy

  • FizzBuzzNumbersMap

Indexable

  • [ index: number]: string

Maps numbers to their corresponding FizzBuzz string.

Functions

fizzBuzz

fizzBuzz(shouldContinue: function, map: FizzBuzzNumbersMap, incrementer: function, startValue: number): string | number[]

Defined in index.ts:24

Calculates a FizzBuzz for any desired set. All inputs are optional.

Parameters:

Default value shouldContinue: function= (i) => i < 100

Function that returns a value on whether the FizzBuzz should continue or not. (Default: stops at 100)

▸ (index: number): boolean

Parameters:

Name Type
index number

Default value map: FizzBuzzNumbersMap= {3: "Fizz", 5: "Buzz"}

Map between numbers and their corresponding words. (Default: {3: "Fizz", 5: "Buzz"})

Default value incrementer: function= (i) => i + 1

Function to increment to the next value. (Default: (i) => i + 1)

▸ (index: number): number

Parameters:

Name Type
index number

Default value startValue: number= 0

The value to start at. (Default: 0)

Returns: string | number[]

fizzbuzz's People

Contributors

serenalynas avatar sploxfox avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.