Socket
Book a DemoInstallSign in
Socket

cyclejs-utils

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cyclejs-utils

A few utility functions for dealing with merging of sinks

latest
npmnpm
Version
4.0.2
Version published
Maintainers
1
Created
Source

cyclejs-utils

A few helper functions for dealing with sinks

git repository: https://github.com/cyclejs-community/cyclejs-util

npm package: https://www.npmjs.com/package/cyclejs-utils

typedoc documentation: https://cyclejs-community.github.io/cyclejs-utils/

Usage

The most useful functions are mergeSinks and extractSinks.

import { ChildComponent } from 'XXX'
import { mergeSinks, extractSinks } from 'cyclejs-utils'

const drivers = { /* ... */ };
const driverNames = Object.keys(drivers);

function main(sources)
{
    const children$: Stream<Sinks[]> = sources.state
        .map(s => s.childState.map(c => ChildComponent(sources)));

    // Merge all children Sinks automaticly, but combine DOM and display in div
    const child$: Stream<Sinks> = children$.map(arr => mergeSinks(arr, {
        DOM: arr => xs.combine(...arr).map(div)
    }));

    return extractSinks(child$, driverNames),
}

Keywords

cyclejs

FAQs

Package last updated on 22 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts