Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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 { fromArray, take, skip, concat, runEffects, tap } from '@most/core';
import { newDefaultScheduler } from '@most/scheduler'
import multicastStream from '@most/multicast'
console.clear()
const scheduler = newDefaultScheduler()
const observe = (f, stream) => runEffects(tap(f, stream), scheduler)
const multicast = (stream) => multicastStream({ source: stream }).source
const stream = multicast(fromArray( [ 1, 2, 3, 4, 5 ] ))
const take1 = take(1, stream)
const skip1 = skip(1, stream)
const result = concat(take1, skip1)
observe(console.log, result)
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"@most/core": "0.4.1",
"@most/multicast": "1.2.5",
"@most/scheduler": "0.4.1"
}
}
'use strict';
var _core = require('@most/core');
var _scheduler = require('@most/scheduler');
var _multicast = require('@most/multicast');
var _multicast2 = _interopRequireDefault(_multicast);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
console.clear();
var scheduler = (0, _scheduler.newDefaultScheduler)();
var observe = function observe(f, stream) {
return (0, _core.runEffects)((0, _core.tap)(f, stream), scheduler);
};
var multicast = function multicast(stream) {
return (0, _multicast2.default)({ source: stream }).source;
};
var stream = multicast((0, _core.fromArray)([1, 2, 3, 4, 5]));
var take1 = (0, _core.take)(1, stream);
var skip1 = (0, _core.skip)(1, stream);
var result = (0, _core.concat)(take1, skip1);
observe(console.log, result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.