made with esnextbin
Created
March 4, 2016 16:28
-
-
Save davidchase/51de8053849835097e8f to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains hidden or 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 hidden or 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 { 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) |
This file contains hidden or 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.0" | |
} | |
} |
This file contains hidden or 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 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