Git Product home page Git Product logo

cycle-convert's Introduction

cycle-convert

๐ŸŒ— Utility for converting cycle.js dataflows between stream libs.

What?

This really very very simple. It uses @cycle stream lib adapters for converting input and output streams in passed dataflow.

  import XsDataflow from './XsDataflow'  
  import xsAdapter from '@cycle/xstream-adapter'
  import rxAdapter from '@cycle/rx-adapter'
  import convert from 'cycle-convert'
  
  ...
  
  const RxDataflow = convert(XsDataflow, xsAdapter, rxAdapter)    
  // plug it in your cycle Rx app!  

It will (at least it should, see cautions) properly convert all driver sources with all their (custom) methods/helpers and stuff.

You may also convert just streams:

  let rxStream$ = convert(mostStream$, mostAdapter, rxAdapter)    

Why you may need it?

Well, for example if you want to migrate incrementally from rxjs to xstream (or maybe visa versa?, don't tell @staltz)

Or you may use some cyclic component created with one stream library inside your other component created using another lib. It is simple.

Cautions

cycle-convert supports traversal of streams - this means it can also convert nested streams hide inside. This may be needed for some driver sinks for example official @cycle/DOM driver with transposition option. To enable stream traversal use traverse option.

const RxComponent = convert(XsComponent, xsAdapter, rxAdapter, {traverseSink: ['DOM']})
// drop it to your cycle Rx app!

Install

npm install cycle-convert -S

Licence

WTF?

cycle-convert's People

Contributors

wclr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.