Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Tahseenm/fizzbuzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Travis Build Codecov Coverage Version MIT License

Fizz Buzz ✨

Play the classic interview Fizz Buzz game

MIT License

Why not? A great template for opensource javascript projects. This was inspired by @kentcdodds awesome course on egghead

Table of Contents

Requirements

NodeJS

Browser Support

Chrome Safari IE / Edge Firefox Opera
Yes Yes 9+ Yes Yes

Installation

Using npm

> npm install --save fizz_buzz

Using yarn

> yarn add fizz_buzz

Documentation

Example 1

import playFizzBuzz from 'fizz_buzz'
import isString from './utils'


/**
 * Sexy `Fizz` / `Buzz` / `FizzBuzz` console logging ✨
 */
const printToConsole = (val) => {
  const styles = {
    reg: 'font-size: 14px',
    fancy: `
      padding: 3px;
      font-size: 14px;
      font-weight: bold;
      color: tomato;
      background-color: #000;
    `,
  }

  console.log(`%c${val}`, isString(val) ? styles.fancy : styles.reg)
}


playFizzBuzz(printToConsole)

Example 2

import playFizzBuzz from 'fizz_buzz'
import isString from './utils'


const wrapper = document.getElementById('fizzbuzz-wrapper')

const printToPage = (val) => {
  const elem = document.createElement('li')
  const className = isString(val) ? 'fizzbuzz' : 'number'

  elem.innerHTML = `<span class="${className}">
    ${val}
  </span>`

  wrapper.appendChild(elem)
}


playFizzBuzz(printToPage)

Contributors

Tahseen Malik

License

MIT