Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
> = component =>
pipe(
component.observe(),
map(({ prop }) => ({
newProp: `${prop} world`
})),
map(asProps)
)
export const toCallback = <a>(callback: Callback</a><a>) => (source: Source</a><a>) => {
if (callback == null) callback = (_, error) => error && console.log(error)
return pipe(
source,
catchError((error: Error) => callback(null, error)),
observe((value: A) => callback(value, null))
)
}
export const toCallbackOrPromise = </a><a>(cb?: Callback</a><a>) => (source: Source</a><a>) => {</a>
function counters$(realtime, next) {
return pipe(
fromObs(channelToObs(realtime, 'chat:counters')),
map(msg => msg.params),
map(counters => ({
...counters,
isOnline: new window.Map(counters.peers || []),
})),
subscribe({ next })
);
}
.add('cb-basics', function (deferred) {
runners.runCallbag(deferred,
callbag.pipe(
fromArray(a),
callbag.filter(even),
callbag.map(add1),
callbag.scan(sum, 0)
)
);
}, options)
.add('xstream', function (deferred) {
.add('cb-basics', function (deferred) {
runners.runCallbag(deferred,
callbag.pipe(
fromArray(a),
callbag.map(add1),
callbag.filter(odd),
callbag.map(add1),
callbag.map(add1),
callbag.filter(even),
callbag.scan(sum, 0)
)
);
}, options)
.add('xstream', function (deferred) {
.add('cb-basics', function (deferred) {
runners.runCallbag(deferred,
callbag.pipe(
callbag.combine(cbag1, cbag2, cbag3),
callbag.map(add3Arr),
callbag.filter(even)
)
);
}, options)
.add('xstream', function (deferred) {
addFilter( 'carbon-fields.conditional-display-post-format.classic', 'carbon-fields/metaboxes', () => {
const node = document.querySelector( 'div#post-formats-select' );
if ( ! node ) {
return of( INITIAL_STATE );
}
return pipe(
fromDelegatedEvent( node, 'input.post-format', 'change' ),
map( ( { target } ) => getPostFormatFromRadioInput( target ) ),
startWith( getPostFormatFromRadioInput( node.querySelector( 'input.post-format:checked' ) ) )
);
} );
function counters$(realtime, next) {
return pipe(
fromObs(channelToObs(realtime, 'chat:counters')),
map(msg => msg.params),
map(counters => ({
...counters,
isOnline: new window.Map(counters.peers || []),
})),
subscribe({ next })
);
}
const aperture = ({ observe }) =>
pipe(
observe('username'),
filter(Boolean),
debounce(1000),
map(username =>
fromPromise(
fetch(`https://api.github.com/users/${username}`).then(res =>
res.json()
)
)
),
flatten,
map(payload => ({ type: 'USER_DATA_RECEIVE', payload }))
)
.add('cb-basics', function (deferred) {
runners.runCallbag(deferred,
callbag.pipe(
callbag.combine(cbag1, cbag2, cbag3),
callbag.map(add3Arr),
callbag.filter(even)
)
);
}, options)
.add('xstream', function (deferred) {