made with esnextbin
Created
April 12, 2016 03:32
-
-
Save TylorS/45a87f73deb0da20cd9912faf7994405 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 {empty, just, multicast} from 'most'; | |
import hold from '@most/hold' | |
const defaultTo = function(defaultVal, s){ | |
const m = hold(s).multicast(); | |
return just(defaultVal).until(m).concat(m); | |
}; | |
const a$ = just('otherwise').map(function(x){ | |
console.log(x); | |
return x.toUpperCase(); | |
}).multicast() | |
defaultTo('hello there', a$).observe(console.warn.bind(console)); |
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": { | |
"most": "0.18.8", | |
"@most/hold": "1.1.1" | |
} | |
} |
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 _most = require('most'); | |
var _hold = require('@most/hold'); | |
var _hold2 = _interopRequireDefault(_hold); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var defaultTo = function defaultTo(defaultVal, s) { | |
var m = (0, _hold2.default)(s).multicast(); | |
return (0, _most.just)(defaultVal).until(m).concat(m); | |
}; | |
var a$ = (0, _most.just)('otherwise').map(function (x) { | |
console.log(x); | |
return x.toUpperCase(); | |
}).multicast(); | |
defaultTo('hello there', a$).observe(console.warn.bind(console)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment