Gathering detailed insights and metrics for thenify
Gathering detailed insights and metrics for thenify
Gathering detailed insights and metrics for thenify
Gathering detailed insights and metrics for thenify
npm install thenify
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
2,058,176,019
Last Day
1,297,658
Last Week
19,985,184
Last Month
87,236,311
Last Year
806,111,386
MIT License
109 Stars
34 Commits
19 Forks
3 Watchers
1 Branches
10 Contributors
Updated on Feb 01, 2025
Minified
Minified + Gzipped
Latest Version
3.3.1
Package Id
thenify@3.3.1
Size
3.00 kB
NPM Version
6.12.0
Node Version
10.16.0
Published on
Jun 17, 2020
Cumulative downloads
Total Downloads
Last Day
-17.9%
1,297,658
Compared to previous day
Last Week
-10.1%
19,985,184
Compared to previous week
Last Month
-2%
87,236,311
Compared to previous month
Last Year
61.2%
806,111,386
Compared to previous year
1
Promisify a callback-based function using any-promise
.
bluebird
Array
, also support change the behavior by options.multiArgs
An added benefit is that throw
n errors in that async function will be caught by the promise!
Promisifies a function.
options
are optional.
options.withCallback
- support both callback and promise style, default to false
.
options.multiArgs
- change the behavior when callback have multiple arguments. default to true
.
true
- converts multiple arguments to an arrayfalse
- always use the first argumentArray
- converts multiple arguments to an object with keys provided in options.multiArgs
Turn async functions into promises
1var thenify = require('thenify'); 2 3var somethingAsync = thenify(function somethingAsync(a, b, c, callback) { 4 callback(null, a, b, c); 5});
1var thenify = require('thenify'); 2 3var somethingAsync = thenify(function somethingAsync(a, b, c, callback) { 4 callback(null, a, b, c); 5}, { withCallback: true }); 6 7// somethingAsync(a, b, c).then(onFulfilled).catch(onRejected); 8// somethingAsync(a, b, c, function () {});
or use thenify.withCallback()
1var thenify = require('thenify').withCallback; 2 3var somethingAsync = thenify(function somethingAsync(a, b, c, callback) { 4 callback(null, a, b, c); 5}); 6 7// somethingAsync(a, b, c).then(onFulfilled).catch(onRejected); 8// somethingAsync(a, b, c, function () {});
1var thenify = require('thenify'); 2 3var promise = thenify(function (callback) { 4 callback(null, 1, 2, 3); 5}, { multiArgs: false }); 6 7// promise().then(function onFulfilled(value) { 8// assert.equal(value, 1); 9// });
1var thenify = require('thenify'); 2 3var promise = thenify(function (callback) { 4 callback(null, 1, 2, 3); 5}, { multiArgs: [ 'one', 'tow', 'three' ] }); 6 7// promise().then(function onFulfilled(value) { 8// assert.deepEqual(value, { 9// one: 1, 10// tow: 2, 11// three: 3 12// }); 13// });
9.8/10
Summary
thenify before 3.3.1 made use of unsafe calls to `eval`.
Affected Versions
< 3.3.1
Patched Versions
3.3.1
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 7/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More