Skip to content

Instantly share code, notes, and snippets.

@TylorS
Created April 12, 2016 03:32
Show Gist options
  • Save TylorS/45a87f73deb0da20cd9912faf7994405 to your computer and use it in GitHub Desktop.
Save TylorS/45a87f73deb0da20cd9912faf7994405 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 {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));
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"most": "0.18.8",
"@most/hold": "1.1.1"
}
}
'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