Comparing version 1.4.2 to 1.4.3
@@ -537,2 +537,81 @@ function pipe(source) { | ||
function switchMap(f) { | ||
return function(source) { | ||
return function(sink) { | ||
var state = [talkbackPlaceholder, talkbackPlaceholder, !1, !1, !1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
state[4] = !0; | ||
if (state[2]) { | ||
return 0; | ||
} else { | ||
return sink(0); | ||
} | ||
} | ||
} else if (signal.tag) { | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
if (state[2]) { | ||
state[1](1); | ||
state[1] = talkbackPlaceholder; | ||
} | ||
_1(f(signal[0]), function(signal) { | ||
if ("number" == typeof signal) { | ||
state[2] = !1; | ||
state[1] = talkbackPlaceholder; | ||
if (state[4]) { | ||
return sink(0); | ||
} else { | ||
return 0; | ||
} | ||
} else if (signal.tag) { | ||
if (state[3]) { | ||
return 0; | ||
} else { | ||
sink(__(1, [signal[0]])); | ||
return state[1](0); | ||
} | ||
} else { | ||
var tb = signal[0]; | ||
state[2] = !0; | ||
state[1] = tb; | ||
return tb(0); | ||
} | ||
}); | ||
return state[0](0); | ||
} | ||
} else { | ||
var tb = signal[0]; | ||
state[0] = tb; | ||
return tb(0); | ||
} | ||
}); | ||
return sink( | ||
__(0, [ | ||
function(signal) { | ||
if (signal) { | ||
state[1](1); | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
state[4] = !0; | ||
state[3] = !0; | ||
state[0](1); | ||
state[1] = talkbackPlaceholder; | ||
return 0; | ||
} | ||
} else { | ||
return state[1](0); | ||
} | ||
} | ||
]) | ||
); | ||
}; | ||
}; | ||
} | ||
var Types = 0; | ||
@@ -980,79 +1059,8 @@ | ||
var switchMap$1 = function switchMap(f) { | ||
return function(source) { | ||
return function(sink) { | ||
var state = [talkbackPlaceholder, talkbackPlaceholder, !1, !1, !1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
state[4] = !0; | ||
if (state[2]) { | ||
return 0; | ||
} else { | ||
return sink(0); | ||
} | ||
} | ||
} else if (signal.tag) { | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
if (state[2]) { | ||
state[1](1); | ||
state[1] = talkbackPlaceholder; | ||
} | ||
_1(f(signal[0]), function(signal) { | ||
if ("number" == typeof signal) { | ||
state[2] = !1; | ||
state[1] = talkbackPlaceholder; | ||
if (state[4]) { | ||
return sink(0); | ||
} else { | ||
return 0; | ||
} | ||
} else if (signal.tag) { | ||
if (state[3]) { | ||
return 0; | ||
} else { | ||
sink(__(1, [signal[0]])); | ||
return state[1](0); | ||
} | ||
} else { | ||
var tb = signal[0]; | ||
state[2] = !0; | ||
state[1] = tb; | ||
return tb(0); | ||
} | ||
}); | ||
return state[0](0); | ||
} | ||
} else { | ||
var tb = signal[0]; | ||
state[0] = tb; | ||
return tb(0); | ||
} | ||
}); | ||
return sink( | ||
__(0, [ | ||
function(signal) { | ||
if (signal) { | ||
state[1](1); | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
state[4] = !0; | ||
state[3] = !0; | ||
state[0](1); | ||
state[1] = talkbackPlaceholder; | ||
return 0; | ||
} | ||
} else { | ||
return state[1](0); | ||
} | ||
} | ||
]) | ||
); | ||
}; | ||
}; | ||
var switchMap$1 = switchMap; | ||
var switchAll$1 = function switchAll(source) { | ||
return switchMap(function(x) { | ||
return x; | ||
})(source); | ||
}; | ||
@@ -1231,11 +1239,34 @@ | ||
return function(sink) { | ||
var ended = [!1]; | ||
return _1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
onEnd(); | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
ended[0] = !0; | ||
return onEnd(); | ||
} | ||
} else if (signal.tag) { | ||
onPush(signal[0]); | ||
return sink(signal); | ||
} else { | ||
var talkback = signal[0]; | ||
onStart(); | ||
return sink( | ||
__(0, [ | ||
function(signal) { | ||
if (signal) { | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
ended[0] = !0; | ||
return onEnd(); | ||
} | ||
} else { | ||
return talkback(signal); | ||
} | ||
} | ||
]) | ||
); | ||
} | ||
return sink(signal); | ||
}); | ||
@@ -1605,2 +1636,3 @@ }; | ||
switchMap$1 as switchMap, | ||
switchAll$1 as switchAll, | ||
take$1 as take, | ||
@@ -1607,0 +1639,0 @@ takeLast$1 as takeLast, |
@@ -527,2 +527,81 @@ function __(tag, block) { | ||
function switchMap(f) { | ||
return function(source) { | ||
return function(sink) { | ||
var state = [talkbackPlaceholder, talkbackPlaceholder, !1, !1, !1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
state[4] = !0; | ||
if (state[2]) { | ||
return 0; | ||
} else { | ||
return sink(0); | ||
} | ||
} | ||
} else if (signal.tag) { | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
if (state[2]) { | ||
state[1](1); | ||
state[1] = talkbackPlaceholder; | ||
} | ||
_1(f(signal[0]), function(signal) { | ||
if ("number" == typeof signal) { | ||
state[2] = !1; | ||
state[1] = talkbackPlaceholder; | ||
if (state[4]) { | ||
return sink(0); | ||
} else { | ||
return 0; | ||
} | ||
} else if (signal.tag) { | ||
if (state[3]) { | ||
return 0; | ||
} else { | ||
sink(__(1, [signal[0]])); | ||
return state[1](0); | ||
} | ||
} else { | ||
var tb = signal[0]; | ||
state[2] = !0; | ||
state[1] = tb; | ||
return tb(0); | ||
} | ||
}); | ||
return state[0](0); | ||
} | ||
} else { | ||
var tb = signal[0]; | ||
state[0] = tb; | ||
return tb(0); | ||
} | ||
}); | ||
return sink( | ||
__(0, [ | ||
function(signal) { | ||
if (signal) { | ||
state[1](1); | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
state[4] = !0; | ||
state[3] = !0; | ||
state[0](1); | ||
state[1] = talkbackPlaceholder; | ||
return 0; | ||
} | ||
} else { | ||
return state[1](0); | ||
} | ||
} | ||
]) | ||
); | ||
}; | ||
}; | ||
} | ||
var fromArray$1 = fromArray; | ||
@@ -968,79 +1047,8 @@ | ||
var switchMap$1 = function switchMap(f) { | ||
return function(source) { | ||
return function(sink) { | ||
var state = [talkbackPlaceholder, talkbackPlaceholder, !1, !1, !1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
state[4] = !0; | ||
if (state[2]) { | ||
return 0; | ||
} else { | ||
return sink(0); | ||
} | ||
} | ||
} else if (signal.tag) { | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
if (state[2]) { | ||
state[1](1); | ||
state[1] = talkbackPlaceholder; | ||
} | ||
_1(f(signal[0]), function(signal) { | ||
if ("number" == typeof signal) { | ||
state[2] = !1; | ||
state[1] = talkbackPlaceholder; | ||
if (state[4]) { | ||
return sink(0); | ||
} else { | ||
return 0; | ||
} | ||
} else if (signal.tag) { | ||
if (state[3]) { | ||
return 0; | ||
} else { | ||
sink(__(1, [signal[0]])); | ||
return state[1](0); | ||
} | ||
} else { | ||
var tb = signal[0]; | ||
state[2] = !0; | ||
state[1] = tb; | ||
return tb(0); | ||
} | ||
}); | ||
return state[0](0); | ||
} | ||
} else { | ||
var tb = signal[0]; | ||
state[0] = tb; | ||
return tb(0); | ||
} | ||
}); | ||
return sink( | ||
__(0, [ | ||
function(signal) { | ||
if (signal) { | ||
state[1](1); | ||
if (state[4]) { | ||
return 0; | ||
} else { | ||
state[4] = !0; | ||
state[3] = !0; | ||
state[0](1); | ||
state[1] = talkbackPlaceholder; | ||
return 0; | ||
} | ||
} else { | ||
return state[1](0); | ||
} | ||
} | ||
]) | ||
); | ||
}; | ||
}; | ||
var switchMap$1 = switchMap; | ||
var switchAll$1 = function switchAll(source) { | ||
return switchMap(function(x) { | ||
return x; | ||
})(source); | ||
}; | ||
@@ -1219,11 +1227,34 @@ | ||
return function(sink) { | ||
var ended = [!1]; | ||
return _1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
onEnd(); | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
ended[0] = !0; | ||
return onEnd(); | ||
} | ||
} else if (signal.tag) { | ||
onPush(signal[0]); | ||
return sink(signal); | ||
} else { | ||
var talkback = signal[0]; | ||
onStart(); | ||
return sink( | ||
__(0, [ | ||
function(signal) { | ||
if (signal) { | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
ended[0] = !0; | ||
return onEnd(); | ||
} | ||
} else { | ||
return talkback(signal); | ||
} | ||
} | ||
]) | ||
); | ||
} | ||
return sink(signal); | ||
}); | ||
@@ -1625,2 +1656,4 @@ }; | ||
exports.switchAll = switchAll$1; | ||
exports.take = take$1; | ||
@@ -1627,0 +1660,0 @@ |
@@ -91,3 +91,10 @@ 'use strict'; | ||
function switchAll(source) { | ||
return switchMap((function (x) { | ||
return x; | ||
}))(source); | ||
} | ||
exports.switchMap = switchMap; | ||
exports.switchAll = switchAll; | ||
/* No side effect */ |
'use strict'; | ||
var Block = require("bs-platform/lib/js/block.js"); | ||
var Curry = require("bs-platform/lib/js/curry.js"); | ||
@@ -8,11 +9,30 @@ | ||
return (function (sink) { | ||
var ended = /* record */[/* contents */false]; | ||
return Curry._1(source, (function (signal) { | ||
if (typeof signal === "number") { | ||
onEnd(); | ||
if (ended[0]) { | ||
return /* () */0; | ||
} else { | ||
ended[0] = true; | ||
return onEnd(); | ||
} | ||
} else if (signal.tag) { | ||
onPush(signal[0]); | ||
return sink(signal); | ||
} else { | ||
var talkback = signal[0]; | ||
onStart(); | ||
return sink(/* Start */Block.__(0, [(function (signal) { | ||
if (signal) { | ||
if (ended[0]) { | ||
return /* () */0; | ||
} else { | ||
ended[0] = true; | ||
return onEnd(); | ||
} | ||
} else { | ||
return talkback(signal); | ||
} | ||
})])); | ||
} | ||
return sink(signal); | ||
})); | ||
@@ -19,0 +39,0 @@ }); |
@@ -78,2 +78,4 @@ 'use strict'; | ||
var switchAll = Wonka_operator_switchMap.switchAll; | ||
var take = Wonka_operator_take.take; | ||
@@ -139,2 +141,3 @@ | ||
exports.switchMap = switchMap; | ||
exports.switchAll = switchAll; | ||
exports.take = take; | ||
@@ -141,0 +144,0 @@ exports.takeLast = takeLast; |
{ | ||
"name": "wonka", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"author": "Phil Pluckthun <phil@kitten.sh>", | ||
@@ -5,0 +5,0 @@ "source": "./src/index.js", |
import { Source, Operator } from '../wonka_types'; | ||
export const switchMap: <A, B>(f: (value: A) => Source<B>) => Operator<A, B>; | ||
export const switchAll: <A>(source: Source<Source<A>>) => Source<A>; |
@@ -91,6 +91,13 @@ | ||
function switchAll(source) { | ||
return switchMap((function (x) { | ||
return x; | ||
}))(source); | ||
} | ||
export { | ||
switchMap , | ||
switchAll , | ||
} | ||
/* No side effect */ |
import * as Block from "bs-platform/lib/es6/block.js"; | ||
import * as Curry from "bs-platform/lib/es6/curry.js"; | ||
@@ -8,11 +9,30 @@ | ||
return (function (sink) { | ||
var ended = /* record */[/* contents */false]; | ||
return Curry._1(source, (function (signal) { | ||
if (typeof signal === "number") { | ||
onEnd(); | ||
if (ended[0]) { | ||
return /* () */0; | ||
} else { | ||
ended[0] = true; | ||
return onEnd(); | ||
} | ||
} else if (signal.tag) { | ||
onPush(signal[0]); | ||
return sink(signal); | ||
} else { | ||
var talkback = signal[0]; | ||
onStart(); | ||
return sink(/* Start */Block.__(0, [(function (signal) { | ||
if (signal) { | ||
if (ended[0]) { | ||
return /* () */0; | ||
} else { | ||
ended[0] = true; | ||
return onEnd(); | ||
} | ||
} else { | ||
return talkback(signal); | ||
} | ||
})])); | ||
} | ||
return sink(signal); | ||
})); | ||
@@ -19,0 +39,0 @@ }); |
@@ -1,3 +0,3 @@ | ||
import { Operator } from '../wonka_types'; | ||
import { Operator, Source } from '../wonka_types'; | ||
export const fromPromise: <A>(promise: Promise<A>) => Source<A>; |
@@ -78,2 +78,4 @@ | ||
var switchAll = Wonka_operator_switchMap.switchAll; | ||
var take = Wonka_operator_take.take; | ||
@@ -140,2 +142,3 @@ | ||
switchMap , | ||
switchAll , | ||
take , | ||
@@ -142,0 +145,0 @@ takeLast , |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
387368
8838