Giter VIP home page Giter VIP logo

pr's Introduction

pr

node builtins wrapped for promises

all of node's builtin apis as Promises/A+ - returning functions. Use the core module APIs you know without the impedence mismatch of adapting them to promises yourself.

js-standard-style

installation

$ npm install pr

usage

require any builtin module with pr/ before it

example

var fs = require('pr/fs')

fs.readdir(__dirname).then(function (files) {
  console.log(__dirname + ':\n' + files.join('\n'))
})

modules included

Methods taking one-time callbacks in the following module are wrapped with promise-returning versions:

Additionally, all base modules are available by require('pr/name') for convenience.

Functions which are documented as taking a callback, but which actually use the callback as an event listener rather than as a continuation, are not supported.

not currently implemented

(http|https).request and .get both take callbacks but also have return values of streams. These will be supported in a future release of pr, and the returned object will support both the stream and promise interface.

readline's Interface#question is not currently implemented.

We're interested in supporting the entire api! Please open a pull request to contribute.

api current as of node 0.8.x

contributors

jden [email protected]

license

Public Domain.

CC0

To the extent possible under law, Jason Denizac has waived all copyright and related or neighboring rights to pr. This work is published from: United States.

pr's People

Contributors

junosuarez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

imclab

pr's Issues

Work with any Promise library

It would be nice if pr would work with any Promise library instead of using a bundled (outdated) bluebird.

This module prfun had a nice pattern where it either uses a local (polyfilled) ES6 Promise or user-supplied one:

var Promise = prfun(require('bluebird'));

Maybe this is interesting forpr too: this pattern saves a Promise.cast() around every call (it gets very tedious) and instead just use the same library as the rest of the user code.

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.