Skip to content

Instantly share code, notes, and snippets.

@TylorS
Last active June 13, 2017 14:40
Show Gist options
  • Save TylorS/c36b839d742823138a575a6c0d69a4ff to your computer and use it in GitHub Desktop.
Save TylorS/c36b839d742823138a575a6c0d69a4ff to your computer and use it in GitHub Desktop.
esnextbin sketch
<!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>
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)
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"167": "0.30.0"
}
}
'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