Socket
Book a DemoInstallSign in
Socket

node-to-prescription

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

node-to-prescription

A wrapper for converting async node functions to prescription FRP observables

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

Node To Prescription

This is a convenience wrapper libary to make converting asynchronous node.js callback style functions to FRP Prescription functions that return Observable's mostly one liners.

Example

var Observable         = require("prescription").Observable;
var nodeToPrescription = require("node-to-prescription");

// A typical node.js callback driven asynchronous function
var doAsync = function(data, next) {
    process.nextTick(function() {
        next(null, "async done: " + data);
    });
};

// Here we wrap the node.js async function to return an Observable
var observableAsync = nodeToPrescription(doAsync);

// Here we issue an async call, get an Observable back, map over the results
// and finally print the result to the console.
observableAsync("joseph").map(function(n) { return n.toUpperCase(); });
                         .subscribe(function(m) { console.log(n); });

Keywords

streams

FAQs

Package last updated on 22 May 2013

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