change m.request return value from stream to promise

remove m.prop
add m.Promise
update tests and examples
This commit is contained in:
Leo Horie 2016-11-13 22:44:22 -05:00
parent 8f1a69cfcb
commit bc8cf4ed76
19 changed files with 650 additions and 852 deletions

View file

@ -16,7 +16,7 @@ module.exports = function(log) {
function initStream(stream) {
stream.constructor = createStream
stream._state = {id: guid++, value: undefined, error: undefined, state: 0, derive: undefined, recover: undefined, deps: {}, parents: [], errorStream: undefined, endStream: undefined}
stream["fantasy-land/map"] = map, stream["fantasy-land/ap"] = ap, stream["fantasy-land/of"] = createStream
stream.map = stream["fantasy-land/map"] = map, stream["fantasy-land/ap"] = ap, stream["fantasy-land/of"] = createStream
stream.valueOf = valueOf, stream.toJSON = toJSON, stream.toString = valueOf
stream.run = run, stream.catch = doCatch
@ -36,7 +36,7 @@ module.exports = function(log) {
end: {get: function() {
if (!stream._state.endStream) {
var endStream = createStream()
endStream["fantasy-land/map"](function(value) {
endStream.map(function(value) {
if (value === true) unregisterStream(stream), unregisterStream(endStream)
return value
})

View file

@ -918,6 +918,11 @@ o.spec("stream", function() {
o(mapped()()).equals(undefined)
})
o("has alias", function() {
var stream = Stream(undefined)
o(stream["fantasy-land/map"]).equals(stream.map)
})
})
o.spec("ap", function() {
o("works", function() {