Fulfill long runinng promises on timeout.
Installations
npm install time-limit-promise
Score
100
Supply Chain
74.3
Quality
75.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Developer
inikulin
Developer Guide
Module System
CommonJS
Min. Node Version
>= 0.12
Typescript Support
No
Node Version
8.11.1
NPM Version
6.0.1
Statistics
11 Stars
13 Commits
2 Forks
3 Watching
1 Branches
3 Contributors
Updated on 05 Mar 2022
Bundle Size
416.00 B
Minified
259.00 B
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
63,336,305
Last day
-1.8%
33,713
Compared to previous day
Last week
-4.4%
184,596
Compared to previous week
Last month
-8.9%
845,187
Compared to previous month
Last year
0%
11,165,602
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
1
time-limit-promise
Fulfill long runinng promises on timeout.
Unlike other implementations on npm it has some nice extra features:
- You can both reject and resolve promises on timeout
- You can provide custom value with which promise will be rejected or resolved on timeout
- Unrefs promise timer, so it will not block your app from exit.
- Uses
Promise
implementation of the passed promise: no external implementation dependencies, no globalPromise
dependencies
Install
npm install time-limit-promise
Usage
1const timeLimit = require('time-limit-promise'); 2const fetch = require('node-fetch'); 3 4var fetchPromise = fetch('https://github.com/inikulin'); 5 6timeLimit(fetchPromise, 50).then(res => { 7 // If `fetchPromise` will be fulfilled within 50ms 8 // time limited promise will be fullfilled as well. 9 // Otherwise, it will be resolved with the `undefined` value. 10}); 11 12timeLimit(fetchPromise, 50, { resolveWith: 'no content' }).then(res => { 13 // Same as above, but on timeout it will 14 // be resolved with the `no-content` value. 15 console.log(res); // > no-content 16}); 17 18 19timeLimit(fetchPromise, 50, { rejectWith: new Error('timeout') }).catch(err => { 20 // Same as above, but on timeout it will 21 // be rejected with the provided error. 22 console.log(err.message); // > timeout 23}); 24
Author
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 2/9 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
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Score
3.3
/10
Last Scanned on 2024-11-25
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