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
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
12 Stars
65 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Oct 24, 2024
Latest Version
1.1.3
Package Id
@gar/promisify@1.1.3
Unpacked Size
4.10 kB
Size
2.07 kB
File Count
4
NPM Version
8.4.1
Node Version
16.14.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
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 dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/17 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
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 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