Skip to content

Instantly share code, notes, and snippets.

@davidchase
Created March 4, 2016 16:28
Show Gist options
  • Save davidchase/51de8053849835097e8f to your computer and use it in GitHub Desktop.
Save davidchase/51de8053849835097e8f 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 { filter, multicast } from 'most'
const split = (predicate, stream) =>
splitStream(predicate, multicast(stream))
const splitStream = (predicate, stream) =>
[stream.filter(predicate), stream.filter(negate(predicate))]
const negate = predicate => x => !predicate(x)
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"most": "0.18.0"
}
}
'use strict';
var _most = require('most');
var split = function split(predicate, stream) {
return splitStream(predicate, (0, _most.multicast)(stream));
};
var splitStream = function splitStream(predicate, stream) {
return [stream.filter(predicate), stream.filter(negate(predicate))];
};
var negate = function negate(predicate) {
return function (x) {
return !predicate(x);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment