Gathering detailed insights and metrics for @gar/promisify
Gathering detailed insights and metrics for @gar/promisify
Gathering detailed insights and metrics for @gar/promisify
Gathering detailed insights and metrics for @gar/promisify
npm install @gar/promisify
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
12 Stars
65 Commits
3 Watching
1 Branches
1 Contributors
Updated on 24 Oct 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-1.6%
1,378,508
Compared to previous day
Last week
1.9%
7,261,685
Compared to previous week
Last month
9.6%
30,350,187
Compared to previous month
Last year
-22.4%
384,818,316
Compared to previous year
3
This module leverages es6 Proxy and Reflect to promisify every function in an object or class instance.
It assumes the callback that the function is expecting is the last
parameter, and that it is an error-first callback with only one value,
i.e. (err, value) => ...
. This mirrors node's util.promisify
method.
In order that you can use it as a one-stop-shop for all your promisify
needs, you can also pass it a function. That function will be
promisified as normal using node's built-in util.promisify
method.
node's custom promisified
functions
will also be mirrored, further allowing this to be a drop-in replacement
for the built-in util.promisify
.
Promisify an entire object
1 2const promisify = require('@gar/promisify') 3 4class Foo { 5 constructor (attr) { 6 this.attr = attr 7 } 8 9 double (input, cb) { 10 cb(null, input * 2) 11 } 12 13const foo = new Foo('baz') 14const promisified = promisify(foo) 15 16console.log(promisified.attr) 17console.log(await promisified.double(1024))
Promisify a function
1 2const promisify = require('@gar/promisify') 3 4function foo (a, cb) { 5 if (a !== 'bad') { 6 return cb(null, 'ok') 7 } 8 return cb('not ok') 9} 10 11const promisified = promisify(foo) 12 13// This will resolve to 'ok' 14promisified('good') 15 16// this will reject 17promisified('bad')
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3
Reason
Found 0/17 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
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