Installations
npm install vtry
Releases
Unable to fetch releases
Developer
mk-pmb
Developer Guide
Module System
CommonJS, ESM
Min. Node Version
Typescript Support
No
Node Version
8.17.0
NPM Version
6.14.16
Statistics
14 Commits
2 Watching
1 Branches
1 Contributors
Updated on 04 Apr 2022
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
45,121
Last day
-40%
27
Compared to previous day
Last week
18.2%
286
Compared to previous week
Last month
-17.7%
883
Compared to previous month
Last year
4.3%
13,466
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
6
vtry
tryit + verror = Verbosely try.
API
This module exports one function that can be called in several ways described below. In each case,
f
is the original function that might throw.g
is a proxy function that wrapsf
, preserving context (this
) and arguments. If no error is thrown, it forwards the result.
g = vtry(f)
Errors are silently ignored.
g = vtry(f, hnd[, ...args])
In case of an error, return hnd(err, ...args)
.
g = vtry(f, errMsg[, errOpt])
- Required prior knowledge: verror
Decorate potentially-cryptic errors with an error message errMsg
that
ideally describes what operation you were trying to perform.
errMsg
must be either a non-empty string or an array.
It will be used as the sprintf_args
to VError
.
errOpt
are the options
as described in VError
.
Â
Promise API
There's also a method vtry.pr
("Promise") which works almost as above,
except it takes an async function f
and returns an async function g
.
As a special convenience, supplying 1
(the number) as f
is a shorthand
for the identity function, so you can easily pass existing promises to g
.
Known issues
- Needs more/better tests and docs.
Â
License
ISC
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/14 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
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
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.6
/10
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