Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

callbag-types

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callbag-types

Types for 👜 Callbags

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

/**



  •                   ⚠️  DO NOT USE! ⚠️
    
  • From what I can tell, Flow does not allow enough fine control
  • over polymorphism to realistically tame the possible typings
  • of callbags. If someone can figure it out, PRs very, very welcome.


  • This library provides types for 👜 Callbags according to the spec.
  • Spec: https://github.com/callbag/callbag
  • Original Typing work: http://blog.krawaller.se/posts/explaining-callbags-via-typescript-definitions/
  • Installation
  • npm install --save-dev callbag-types
  • Usage
  • import type { START, SourceInitiator } from 'callbag-types'
  • @flow */

export type START = 0 export type DATA = 1 export type END = 2

/**

  • Quoth the spec:
  • "A callbag is terminated when the first argument is 2 and the second
  • argument is either undefined (signalling termination due to success)
  • or any truthy value (signalling termination due to failure)." */ export type SourceTalkback = ((DATA, T) => void) & ((END, error?: any) => void)

export type SinkTalkback = (( START, SourceTalkback | SourceInitiator ) => void) & SourceTalkback

/**

  • Quoth the spec:
  • "When a source is greeted and given a sink as payload, the sink MUST
  • be greeted back with a callbag payload that is either the source
  • itself or another callbag (known as the 'talkback'). In other
  • words, greets are mutual. Reciprocal greeting is called a handshake." */ export type SourceInitiator = (START, SinkTalkback) => void

export type SinkConnector = ( source: SourceInitiator ) => ?SourceInitiator

export type SourceFactory = (...args: any[]) => SourceInitiator

export type Operator = (...args: any[]) => SinkConnector

export type Callbag = | SourceTalkback<> | SinkTalkback<> | SourceFactory<> | SourceInitiator<> | SinkConnector<*>

FAQs

Package last updated on 13 Jun 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc