proback.js
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "proback.js", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Tiny libary to aid Promise/Callback dual API design", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -23,4 +23,28 @@ proback.js - dependency-free very minimal helper for APIs with Promise/callback dual design | ||
```javascript | ||
var Proback = require('proback.js'); | ||
... | ||
assigner.assign( obj1, obj2[, obj3[, respect]] ); | ||
new Promise( function (resolve, reject) { | ||
//some callback is needed? | ||
object.fnCallWithCallback( data, Proback.handler( null, resolve, reject ) ) | ||
}).then( function (res) { | ||
expect(res).to.equal('Done.') | ||
done() | ||
}) | ||
``` | ||
```javascript | ||
var Proback = require('proback.js'); | ||
... | ||
new Promise( function (resolve, reject) { | ||
//some callback is needed? | ||
object.fnCallWithCallback( data, function (err, res) { | ||
if (err) return Proback.rejecter(err, null, reject) | ||
// some operation | ||
return Proback.resolver(res, null, resolve) | ||
} ) | ||
}).then( function (res) { | ||
expect(res).to.equal('Done.') | ||
done() | ||
}) | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8853
50