0.0.0 • Published 8 years ago

tcomb-kfr v0.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

tcomb-kfr

tcomb type definitions and combinators for kefir frp library.

Installation

npm install tcomb-kfr

Usage

T = require 'tcomb-kfr'
K = require 'kefir'

User = T.struct
  name: T.String
  email: T.String
, 'User'

Selector = T.func [User], T.Any, 'Selector'

select = T.func [T.obs(User), Selector], T.prop(T.Any), 'select'
.of (obs, selector) ->
  obs.map(selector).skipDuplicates().toProperty()

userProp = K.constant User name: 'nl0', email: 'nl0@example.com'
nameProp = select uProp, ({name}) -> name

API

The following types

  • Observable
  • Stream
  • Property

and combinators

  • observable(type) (aliased as obs)
  • stream(type)
  • property(type) (aliased as prop)

have been added to the tcomb namespace.