Last active
August 29, 2015 14:01
-
-
Save oieioi/de39c2edcc1995682500 to your computer and use it in GitHub Desktop.
給料を500円玉の重さにして返す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env coffee | |
argv = require 'argv' | |
getSalaryMass = (salary, {mass, coin} = {})-> | |
mass = mass or 7 | |
coin = coin or 500 | |
"#{(salary / coin) * mass}" | |
argv.option [ | |
{ | |
name: 'coin' | |
short: 'c' | |
description: '小銭の単位(yen)' | |
type: 'int' | |
},{ | |
name: 'weight' | |
short: 'w' | |
description: '小銭の重さ(g)' | |
type: 'int' | |
} | |
] | |
args = argv.run() | |
result = getSalaryMass args.targets[0], | |
mass: args.options.weight | |
coin: args.options.coin | |
console.log result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment