five-plus
v0.5.2
Published
Gives you five. Better.
Downloads
3
Maintainers
Readme
five-plus
A library to overcomplicate 5
. Better.
Idiomatic CoffeeScript rewrite of the legendary five.js by @jackdcrawford.
Usage
Require the module
Five = require 'five-plus'
In the browser
<script type="text/javascript" src="./lib/five.js"></script>
Basic 5
Five() # 5
Addition
Five() + Five() # 10
Multiplication
Five() * Five() # 25
# Note: a more idiomatic way to do this in CoffeeScript
Five() ** 2 # 25
Division
Five() / Five() # 1
Different sorts of 5
five = new Five()
five.upHigh() # ⁵
five.downLow() # ₅
five.tooSlow() # 5, with a ~500 millisecond delay
five.roman() # V
five.morseCode() # di-di-di-di-dit
5 goes multilingual
five = new Five()
five.arabic() # خمسة
five.choctaw() # tahlapi
five.croatian() # pet
five.czech() # pět
five.english() # Five
five.finnish() # viisi
five.french() # cinq
five.german() # fünf
five.irish() # cúig
five.italian() # cinque
five.mongolian() # таван
five.piglatin() # ivefay
five.polish() # pięć
five.slovenian() # pet
five.spanish() # cinco
five.swedish() # fem
five.thai() # ห้า
Different radices
five = new Five()
five.binary() # 101
five.octal() # 5
Map and Reduce
five.map [1, 2, 3] # [5, 5, 5]
five.reduce [1, 2, 3] # 5
Development
The code
All of the logic & heavy lifting is achieved in one self-contained file:
./lib/five.js
Compiling
Compilation is done using cake
under the hood with an npm-prepublish
script:
npm install
Tests
npm test