relike
Advanced tools
Comparing version 1.1.2 to 1.1.3
## 1.1.3 - 2016-05-15 | ||
- Release v1.1.3 / npm@v1.1.3 | ||
- update docs: showing wrong using of `.Promise` | ||
## 1.1.2 - 2016-05-15 | ||
@@ -4,0 +8,0 @@ - Release v1.1.2 / npm@v1.1.2 |
{ | ||
"name": "relike", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Simple promisify async or sync function with sane defaults. Lower level than `promisify` thing. Can be used to create `promisify` method.", | ||
@@ -5,0 +5,0 @@ "repository": "hybridables/relike", |
@@ -97,3 +97,3 @@ # [relike][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url] [![npm downloads][downloads-img]][downloads-url] | ||
relike.Promise = require('q') // using `Q` promise on node 0.10 | ||
relike.promisify.Promise = require('q') // using `Q` promise on node 0.10 | ||
var readFile = relike.promisify(fs.readFile) | ||
@@ -134,2 +134,15 @@ | ||
Or finally, you can pass Promise constructor as second argument to `.promisify` method. Like that | ||
```js | ||
const fs = require('fs') | ||
const relike = require('relike') | ||
const readFile = relike.promisify(fs.readFile, require('when')) | ||
const promise = readFile('index.js') | ||
console.log(promise.Promise) // => The `when` promise constructor, on old enviroments | ||
console.log(promise.___customPromise) // => `true` on old environments | ||
``` | ||
## Related | ||
@@ -136,0 +149,0 @@ * [callback2stream](https://www.npmjs.com/package/callback2stream): Transform sync, async or generator function to Stream. Correctly handle errors. [homepage](https://github.com/hybridables/callback2stream) |
19058
216