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

cb-to-promise

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cb-to-promise - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

22

package.json
{
"name": "cb-to-promise",
"version": "0.0.1",
"description": "Takes in a node-convential function that has args and a callback and returns a promise",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/maxnachlinger/cb-to-promise.git"
"url": "git+https://github.com/npm/deprecate-holder.git"
},
"scripts": {
"test": "standard && node_modules/.bin/tape tests.js"
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/npm/deprecate-holder/issues"
},
"author": "Max Nachlinger",
"license": "ISC",
"devDependencies": {
"standard": "^6.0.8",
"tape": "^4.5.1"
}
"homepage": "https://github.com/npm/deprecate-holder#readme"
}

@@ -1,56 +0,5 @@

# cb-to-promise
# Deprecated Package
Takes in a node-conventional function that has args and a callback and returns a promise
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.
[![travis][travis-image]][travis-url]
[![npm][npm-image]][npm-url]
[![standard][standard-image]][standard-url]
[travis-image]: https://travis-ci.org/maxnachlinger/cb-to-promise.svg?branch=master
[travis-url]: https://travis-ci.org/maxnachlinger/cb-to-promise
[npm-image]: https://img.shields.io/npm/v/cb-to-promise.svg?style=flat
[npm-url]: https://npmjs.org/package/cb-to-promise
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[standard-url]: http://standardjs.com/
### Installation:
```
npm i cb-to-promise --save
```
### Basic Examples
```javascript
'use strict'
const fx = (cb) => cb()
cbToPromise(fx)()
.then(result => /*no result since callback wasn't called with anything*/)
const fx1 = (cb) => cb(new Error('test error'))
cbToPromise(fx1)()
.catch((err) => {
// promise rejected since callback called with an Error
})
const fx2 = (cb) => cb(null, 'some-result')
cbToPromise(fx2)()
.then((result) => /*'some-result'*/)
})
const fx3 = (cb) => cb(null, 'some-result0', 'some-result1')
// N non error callback args are returned in an array
cbToPromise(fx3)()
.then((results) => /*['some-result0', 'some-result1]*/)
})
const fx4 = (arg0, arg1, cb) => cb(null, 'some-result0', 'some-result1')
// N non error callback args are returned in an array
cbToPromise(fx4)('some arg', 'another arg')
.then((results) => /*['some-result0', 'some-result1]*/)
})
```
Please contact support@npmjs.com if you have questions about this package.
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