made with esnextbin
Last active
November 2, 2016 15:41
-
-
Save aledoroshenko/b209a090ba8d1874640443b945a1f309 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 _ from 'lodash/fp'; | |
import expect from 'expect'; | |
const b = [['a', 'b'], ['c', 'd'], ['e', 'f']]; | |
const fn = (memo, coll) => _.flatMap( _memo => _.map( _coll => _memo.concat([_coll]) ) (coll) ) (memo); | |
console.table(_.reduce(fn, [[]], b)); |
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": { | |
"expect": "1.20.2", | |
"lodash": "4.16.4" | |
} | |
} |
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 _fp = require('lodash/fp'); | |
var _fp2 = _interopRequireDefault(_fp); | |
var _expect = require('expect'); | |
var _expect2 = _interopRequireDefault(_expect); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var b = [['a', 'b'], ['c', 'd'], ['e', 'f']]; | |
var fn = function fn(memo, coll) { | |
return _fp2.default.flatMap(function (_memo) { | |
return _fp2.default.map(function (_coll) { | |
return _memo.concat([_coll]); | |
})(coll); | |
})(memo); | |
}; | |
console.table(_fp2.default.reduce(fn, [[]], b)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment