Gathering detailed insights and metrics for @ragibkl/promisify-ts
Gathering detailed insights and metrics for @ragibkl/promisify-ts
Gathering detailed insights and metrics for @ragibkl/promisify-ts
Gathering detailed insights and metrics for @ragibkl/promisify-ts
Promisify utility function that preserves the original type annotation
npm install @ragibkl/promisify-ts
Typescript
Module System
JavaScript (72.71%)
TypeScript (27.29%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
21 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Sep 03, 2022
Latest Version
0.0.4
Package Id
@ragibkl/promisify-ts@0.0.4
Unpacked Size
4.67 kB
Size
2.07 kB
File Count
8
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
Promisify utility function that preserves the original type annotation
Node's util.promisify
function transforms a callback-style function, into a function that returns a promise.
However, I've noticed that some transformation do not preserve the TypeScript type annotations of the original function.
This package is an attempt to create a similar promisify utility function, with proper typescript support.
Install using npm or yarn
1# install using npm 2npm install @ragibkl/promisify-ts
1# install using yarn 2yarn add @ragibkl/promisify-ts
1import promisify from '@ragibkl/promisify-ts'; 2 3// Sample function that calculates division of a by b 4function divide(a: number, b: number, cb: (err: Error | null, data?: number) => void) { 5 setTimeout(() => { 6 try { 7 if (!b) { 8 throw new TypeError('Cannot divide by zero!'); 9 } 10 11 cb(null, a / b); 12 } catch (err) { 13 cb(err); 14 } 15 }, 100); 16} 17 18const divideAsync = promisify(divide); 19// (a: number, b: number) => Promise<number> 20 21divideAsync(10, 2).then(console.log); 22// 5 23 24divideAsync(0, 0).then(console.log).catch(console.log); 25// TypeError: Cannot divide by zero! 26// at Timeout._onTimeout (/home/ragib/Projects/ragibkl/promisify-ts/src/divide.ts:7:15) 27// at listOnTimeout (internal/timers.js:549:17) 28// at processTimers (internal/timers.js:492:7)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/21 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
32 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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