New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

proback.js

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proback.js - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "proback.js",
"version": "1.0.1",
"version": "1.0.2",
"description": "Tiny libary to aid Promise/Callback dual API design",

@@ -5,0 +5,0 @@ "keywords": [

@@ -26,9 +26,12 @@ proback.js - dependency-free very minimal helper for APIs with Promise/callback dual design

...
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()
})
// your service. If callback is present, works as expected, If not, promise will be provided.
function yourService( data, callback ){
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()
})
}
```

@@ -39,13 +42,16 @@

...
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()
})
// your service. If callback is present, works as expected, If not, promise will be provided.
function yourService( data, callback ){
return 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()
})
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc