task-from-fn

0.1.7 • Public • Published

NOTE: this library's functionality has now been implemented in Folktale: https://origamitower.github.io/folktale/en/folktale.data.task.fromnodeback.html

task-from-fn

Convert a JavaScript function with node-style callback in to a Task from the data.task package.

Installation

$ npm install task-from-fn --save

or with yarn,

$ yarn add task-from-fn

Usage

const taskFromFn = require('task-from-fn')
const fs = require('fs')

const readFile = taskFromFn(fs.readFile)
const task = readFile('path/to/file', 'utf-8')

task.fork(
  e => console.error(e), // handle error
  data => console.log(data) // handle file data
)

Package Sidebar

Install

npm i task-from-fn

Weekly Downloads

1

Version

0.1.7

License

MIT

Last publish

Collaborators

  • rpearce