Last active
September 15, 2016 14:53
-
-
Save suneo3476/d96cced3f9d84f4e7dd7a106dfc85143 to your computer and use it in GitHub Desktop.
test funcy.js for killing stich-case statement
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
'use strict' | |
//normal ver | |
const input0 = 0 | |
const input1 = 1 | |
let output | |
switch(input0){ | |
case 0: | |
output = "あ" | |
break | |
default: | |
output = "うん" | |
break | |
} | |
console.log(output) | |
switch(input1){ | |
case 0: | |
output = "あ" | |
break | |
default: | |
output = "うん" | |
break | |
} | |
console.log(output) | |
//funcy ver | |
const fun = require('funcy') | |
const $ = fun.parameter; | |
const func = fun( | |
[0,function(){return "あ"}], | |
[$,function(){return "うん"}] | |
) | |
console.log(func(0)) | |
console.log(func(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment