Comparing version 1.3.1 to 1.3.2
@@ -407,3 +407,3 @@ function pipe(source) { | ||
if (signal.tag) { | ||
_1(f, signal[0]); | ||
f(signal[0]); | ||
} | ||
@@ -1192,15 +1192,30 @@ } | ||
function forEach(f) { | ||
return function(source) { | ||
return captureTalkback(source, function(signal, talkback) { | ||
if ("number" == typeof signal) { | ||
function publish(source) { | ||
var state = [talkbackPlaceholder, !1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
state[1] = !0; | ||
return 0; | ||
} else if (signal.tag) { | ||
if (state[1]) { | ||
return 0; | ||
} else if (signal.tag) { | ||
_1(f, signal[0]); | ||
return talkback(0); | ||
} else { | ||
return talkback(0); | ||
return state[0](0); | ||
} | ||
}); | ||
}; | ||
} else { | ||
var x = signal[0]; | ||
state[0] = x; | ||
return x(0); | ||
} | ||
}); | ||
return [ | ||
function(param) { | ||
if (state[1]) { | ||
return 0; | ||
} else { | ||
state[1] = !0; | ||
return state[0](1); | ||
} | ||
} | ||
]; | ||
} | ||
@@ -1210,31 +1225,40 @@ | ||
return function(source) { | ||
var talkback = [talkbackPlaceholder]; | ||
var ended = [!1]; | ||
var state = [talkbackPlaceholder, !1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
state[1] = !0; | ||
return 0; | ||
} else if (signal.tag) { | ||
if (ended[0]) { | ||
if (state[1]) { | ||
return 0; | ||
} else { | ||
_1(f, signal[0]); | ||
return talkback[0](0); | ||
f(signal[0]); | ||
return state[0](0); | ||
} | ||
} else { | ||
var x = signal[0]; | ||
talkback[0] = x; | ||
state[0] = x; | ||
return x(0); | ||
} | ||
}); | ||
return function(param) { | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
ended[0] = !0; | ||
return talkback[0](1); | ||
return [ | ||
function(param) { | ||
if (state[1]) { | ||
return 0; | ||
} else { | ||
state[1] = !0; | ||
return state[0](1); | ||
} | ||
} | ||
}; | ||
]; | ||
}; | ||
} | ||
function forEach(f) { | ||
return function(source) { | ||
subscribe(f)(source); | ||
return 0; | ||
}; | ||
} | ||
var Types = 0; | ||
@@ -1599,2 +1623,3 @@ | ||
skipUntil, | ||
publish, | ||
forEach, | ||
@@ -1601,0 +1626,0 @@ subscribe, |
@@ -502,2 +502,35 @@ function __(tag, block) { | ||
function subscribe(f) { | ||
return function(source) { | ||
var state = [talkbackPlaceholder, !1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
state[1] = !0; | ||
return 0; | ||
} else if (signal.tag) { | ||
if (state[1]) { | ||
return 0; | ||
} else { | ||
f(signal[0]); | ||
return state[0](0); | ||
} | ||
} else { | ||
var x = signal[0]; | ||
state[0] = x; | ||
return x(0); | ||
} | ||
}); | ||
return [ | ||
function(param) { | ||
if (state[1]) { | ||
return 0; | ||
} else { | ||
state[1] = !0; | ||
return state[0](1); | ||
} | ||
} | ||
]; | ||
}; | ||
} | ||
var flatten = mergeAll; | ||
@@ -677,3 +710,3 @@ | ||
if (signal.tag) { | ||
_1(f, signal[0]); | ||
f(signal[0]); | ||
} | ||
@@ -1229,48 +1262,41 @@ } | ||
exports.forEach = function forEach(f) { | ||
return function(source) { | ||
return captureTalkback(source, function(signal, talkback) { | ||
if ("number" == typeof signal) { | ||
exports.publish = function publish(source) { | ||
var state = [talkbackPlaceholder, !1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
state[1] = !0; | ||
return 0; | ||
} else if (signal.tag) { | ||
if (state[1]) { | ||
return 0; | ||
} else if (signal.tag) { | ||
_1(f, signal[0]); | ||
return talkback(0); | ||
} else { | ||
return talkback(0); | ||
return state[0](0); | ||
} | ||
}); | ||
}; | ||
} else { | ||
var x = signal[0]; | ||
state[0] = x; | ||
return x(0); | ||
} | ||
}); | ||
return [ | ||
function(param) { | ||
if (state[1]) { | ||
return 0; | ||
} else { | ||
state[1] = !0; | ||
return state[0](1); | ||
} | ||
} | ||
]; | ||
}; | ||
exports.subscribe = function subscribe(f) { | ||
exports.forEach = function forEach(f) { | ||
return function(source) { | ||
var talkback = [talkbackPlaceholder]; | ||
var ended = [!1]; | ||
_1(source, function(signal) { | ||
if ("number" == typeof signal) { | ||
return 0; | ||
} else if (signal.tag) { | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
_1(f, signal[0]); | ||
return talkback[0](0); | ||
} | ||
} else { | ||
var x = signal[0]; | ||
talkback[0] = x; | ||
return x(0); | ||
} | ||
}); | ||
return function(param) { | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
ended[0] = !0; | ||
return talkback[0](1); | ||
} | ||
}; | ||
subscribe(f)(source); | ||
return 0; | ||
}; | ||
}; | ||
exports.subscribe = subscribe; | ||
exports.fromListener = fromListener; | ||
@@ -1277,0 +1303,0 @@ |
@@ -181,3 +181,3 @@ 'use strict'; | ||
if (signal.tag) { | ||
Curry._1(f, signal[0]); | ||
f(signal[0]); | ||
} | ||
@@ -936,15 +936,31 @@ | ||
function forEach(f) { | ||
return (function (source) { | ||
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) { | ||
if (typeof signal === "number") { | ||
return /* () */0; | ||
} else if (signal.tag) { | ||
Curry._1(f, signal[0]); | ||
return talkback(/* Pull */0); | ||
} else { | ||
return talkback(/* Pull */0); | ||
} | ||
})); | ||
}); | ||
function publish(source) { | ||
var state = /* record */[ | ||
/* talkback */Wonka_helpers.talkbackPlaceholder, | ||
/* ended */false | ||
]; | ||
Curry._1(source, (function (signal) { | ||
if (typeof signal === "number") { | ||
state[/* ended */1] = true; | ||
return /* () */0; | ||
} else if (signal.tag) { | ||
if (state[/* ended */1]) { | ||
return 0; | ||
} else { | ||
return state[/* talkback */0](/* Pull */0); | ||
} | ||
} else { | ||
var x = signal[0]; | ||
state[/* talkback */0] = x; | ||
return x(/* Pull */0); | ||
} | ||
})); | ||
return /* record */[/* unsubscribe */(function (param) { | ||
if (state[/* ended */1]) { | ||
return 0; | ||
} else { | ||
state[/* ended */1] = true; | ||
return state[/* talkback */0](/* Close */1); | ||
} | ||
})]; | ||
} | ||
@@ -954,31 +970,41 @@ | ||
return (function (source) { | ||
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder]; | ||
var ended = /* record */[/* contents */false]; | ||
var state = /* record */[ | ||
/* talkback */Wonka_helpers.talkbackPlaceholder, | ||
/* ended */false | ||
]; | ||
Curry._1(source, (function (signal) { | ||
if (typeof signal === "number") { | ||
state[/* ended */1] = true; | ||
return /* () */0; | ||
} else if (signal.tag) { | ||
if (ended[0]) { | ||
if (state[/* ended */1]) { | ||
return /* () */0; | ||
} else { | ||
Curry._1(f, signal[0]); | ||
return talkback[0](/* Pull */0); | ||
f(signal[0]); | ||
return state[/* talkback */0](/* Pull */0); | ||
} | ||
} else { | ||
var x = signal[0]; | ||
talkback[0] = x; | ||
state[/* talkback */0] = x; | ||
return x(/* Pull */0); | ||
} | ||
})); | ||
return (function (param) { | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
ended[0] = true; | ||
return talkback[0](/* Close */1); | ||
} | ||
}); | ||
return /* record */[/* unsubscribe */(function (param) { | ||
if (state[/* ended */1]) { | ||
return 0; | ||
} else { | ||
state[/* ended */1] = true; | ||
return state[/* talkback */0](/* Close */1); | ||
} | ||
})]; | ||
}); | ||
} | ||
function forEach(f) { | ||
return (function (source) { | ||
subscribe(f)(source); | ||
return /* () */0; | ||
}); | ||
} | ||
var Types = 0; | ||
@@ -1017,4 +1043,5 @@ | ||
exports.skipUntil = skipUntil; | ||
exports.publish = publish; | ||
exports.forEach = forEach; | ||
exports.subscribe = subscribe; | ||
/* No side effect */ |
{ | ||
"name": "wonka", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"author": "Phil Pluckthun <phil@kitten.sh>", | ||
@@ -5,0 +5,0 @@ "source": "./src/index.js", |
@@ -1,4 +0,5 @@ | ||
export { Talkback, Signal, Sink, Source, Operator, Observer, Subject } from './wonka_types'; | ||
export { Talkback, Signal, Sink, Subscription, Source, Operator, Observer, Subject } from './wonka_types'; | ||
export * from './pipe'; | ||
export * from './wonka'; | ||
export * from './web/wonkaJs'; |
@@ -77,2 +77,7 @@ import { Source } from './wonka_types'; | ||
export function pipe<T, R>( | ||
source: Source<T>, | ||
consumer: UnaryFn<Source<T>, R> | ||
): R; | ||
export function pipe<T, A, R>( | ||
@@ -79,0 +84,0 @@ source: Source<T>, |
@@ -23,11 +23,6 @@ // Reason Helper Types: | ||
export interface Observer<A> { | ||
[0]: (value: A) => void, | ||
[1]: () => void | ||
} | ||
export type Subscription = [() => void]; | ||
export interface Subject<A> { | ||
[0]: Source<A>, | ||
[1]: (value: A) => void, | ||
[2]: () => void | ||
} | ||
export type Observer<A> = [(value: A) => void, () => void]; | ||
export type Subject<A> = [Source<A>, (value: A) => void, () => void]; |
@@ -1,2 +0,2 @@ | ||
import { List, Sink, Source, Operator, Observer, Subject } from './wonka_types'; | ||
import { List, Sink, Source, Subscription, Operator, Observer, Subject } from './wonka_types'; | ||
@@ -35,6 +35,7 @@ export const makeSubject: <A>() => Subject<A>; | ||
export const skip: <A>(max: number) => Operator<A, A>; | ||
export const skipWhile: <A>(f: (value: A) => boolean) => Operator<A, A>; | ||
export const skipWhile: <A>(f: (x: A) => boolean) => Operator<A, A>; | ||
export const skipUntil: <A>(signal: Source<any>) => Operator<A, A>; | ||
export const publish: <A>(source: Source<A>) => Subscription; | ||
export const forEach: <A>(f: (x: A) => void) => (source: Source<A>) => void; | ||
export const subscribe: <A>(f: (x: A) => void) => (source: Source<A>) => (() => void); | ||
export const subscribe: <A>(f: (x: A) => void) => (source: Source<A>) => Subscription; |
@@ -181,3 +181,3 @@ | ||
if (signal.tag) { | ||
Curry._1(f, signal[0]); | ||
f(signal[0]); | ||
} | ||
@@ -936,15 +936,31 @@ | ||
function forEach(f) { | ||
return (function (source) { | ||
return Wonka_helpers.captureTalkback(source, (function (signal, talkback) { | ||
if (typeof signal === "number") { | ||
return /* () */0; | ||
} else if (signal.tag) { | ||
Curry._1(f, signal[0]); | ||
return talkback(/* Pull */0); | ||
} else { | ||
return talkback(/* Pull */0); | ||
} | ||
})); | ||
}); | ||
function publish(source) { | ||
var state = /* record */[ | ||
/* talkback */Wonka_helpers.talkbackPlaceholder, | ||
/* ended */false | ||
]; | ||
Curry._1(source, (function (signal) { | ||
if (typeof signal === "number") { | ||
state[/* ended */1] = true; | ||
return /* () */0; | ||
} else if (signal.tag) { | ||
if (state[/* ended */1]) { | ||
return 0; | ||
} else { | ||
return state[/* talkback */0](/* Pull */0); | ||
} | ||
} else { | ||
var x = signal[0]; | ||
state[/* talkback */0] = x; | ||
return x(/* Pull */0); | ||
} | ||
})); | ||
return /* record */[/* unsubscribe */(function (param) { | ||
if (state[/* ended */1]) { | ||
return 0; | ||
} else { | ||
state[/* ended */1] = true; | ||
return state[/* talkback */0](/* Close */1); | ||
} | ||
})]; | ||
} | ||
@@ -954,31 +970,41 @@ | ||
return (function (source) { | ||
var talkback = /* record */[/* contents */Wonka_helpers.talkbackPlaceholder]; | ||
var ended = /* record */[/* contents */false]; | ||
var state = /* record */[ | ||
/* talkback */Wonka_helpers.talkbackPlaceholder, | ||
/* ended */false | ||
]; | ||
Curry._1(source, (function (signal) { | ||
if (typeof signal === "number") { | ||
state[/* ended */1] = true; | ||
return /* () */0; | ||
} else if (signal.tag) { | ||
if (ended[0]) { | ||
if (state[/* ended */1]) { | ||
return /* () */0; | ||
} else { | ||
Curry._1(f, signal[0]); | ||
return talkback[0](/* Pull */0); | ||
f(signal[0]); | ||
return state[/* talkback */0](/* Pull */0); | ||
} | ||
} else { | ||
var x = signal[0]; | ||
talkback[0] = x; | ||
state[/* talkback */0] = x; | ||
return x(/* Pull */0); | ||
} | ||
})); | ||
return (function (param) { | ||
if (ended[0]) { | ||
return 0; | ||
} else { | ||
ended[0] = true; | ||
return talkback[0](/* Close */1); | ||
} | ||
}); | ||
return /* record */[/* unsubscribe */(function (param) { | ||
if (state[/* ended */1]) { | ||
return 0; | ||
} else { | ||
state[/* ended */1] = true; | ||
return state[/* talkback */0](/* Close */1); | ||
} | ||
})]; | ||
}); | ||
} | ||
function forEach(f) { | ||
return (function (source) { | ||
subscribe(f)(source); | ||
return /* () */0; | ||
}); | ||
} | ||
var Types = 0; | ||
@@ -1018,2 +1044,3 @@ | ||
skipUntil , | ||
publish , | ||
forEach , | ||
@@ -1020,0 +1047,0 @@ subscribe , |
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
344931
7759