fizz_buzz
Version:
Play Fizz Buzz like a Boss!
112 lines (77 loc) • 2.72 kB
Markdown
[](https://travis-ci.org/Tahseenm/fizzbuzz)
[](https://codecov.io/github/Tahseenm/fizzbuzz)
[](http://npm.im/fizz_buzz)
[](http://opensource.org/licenses/MIT)
# Fizz Buzz
Play the classic interview Fizz Buzz game ✨
[](http://forthebadge.com)
[](http://forthebadge.com)
[](http://forthebadge.com)

Why not? A great **template** for opensource javascript
projects. This was inspired by @kentcdodds awesome course on [egghead](https://egghead.io/courses/how-to-write-an-open-source-javascript-library)
## Table of Contents
* [Requirements](#requirements)
* [Installation](#installation)
* Documentation
* [Example 1](#example-1)
* [Example 2](#example-2)
* [Contributors](#contributors)
* [License](#license)
## Requirements
[NodeJS](https://nodejs.org/en/)
#### Browser Support
| Chrome | Safari | IE / Edge | Firefox | Opera |
| ------ | ------ | --------- | ------- | ----- |
| Yes | Yes | 9+ | Yes | Yes |
## Installation
Using npm
```bash
> npm install --save fizz_buzz
```
Using yarn
```bash
> yarn add fizz_buzz
```
## Documentation
### Example 1
```javascript
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
```javascript
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](https://tahseenmalik.com)
## License
MIT