made with esnextbin
Last active
June 13, 2017 14:40
-
-
Save TylorS/c36b839d742823138a575a6c0d69a4ff to your computer and use it in GitHub Desktop.
esnextbin sketch
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
</body> | |
</html> |
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
import { reduceBy, values, uniq, length } from '167' | |
const gameActions = [ | |
{ position: 'sb', value: 1, type: 'post' }, | |
{ position: 'bb', value: 2, type: 'post' }, | |
{ position: 'sb', value: 5, type: 'bet' }, | |
{ position: 'bb', value: 4, type: 'call' } | |
] | |
const playerBets = | |
reduceBy((sum, gameAction) => sum + gameAction.value, 0, action => action.position, gameActions) | |
const result = length(uniq(values(playerBets))) === 1 | |
console.log(result) |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"167": "0.30.0" | |
} | |
} |
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'; | |
var _ = require('167'); | |
var gameActions = [{ position: 'sb', value: 1, type: 'post' }, { position: 'bb', value: 2, type: 'post' }, { position: 'sb', value: 5, type: 'bet' }, { position: 'bb', value: 4, type: 'call' }]; | |
var playerBets = (0, _.reduceBy)(function (sum, gameAction) { | |
return sum + gameAction.value; | |
}, 0, function (action) { | |
return action.position; | |
}, gameActions); | |
var result = (0, _.length)((0, _.uniq)((0, _.values)(playerBets))) === 1; | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment