Gathering detailed insights and metrics for aproba-browser
Gathering detailed insights and metrics for aproba-browser
Gathering detailed insights and metrics for aproba-browser
Gathering detailed insights and metrics for aproba-browser
npm install aproba-browser
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
28 Commits
2 Watching
2 Branches
1 Contributors
Updated on 04 Jan 2017
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-50%
1
Compared to previous week
Last month
0%
5
Compared to previous month
Last year
-68.3%
82
Compared to previous year
This is the same as the aproba
module except modified to not use Error.captureStackTrace
which doesn't work in browsers. Admittedly, the trace gets some extraneous stuff, but I don't know a better way.
A ridiculously light-weight function argument validator
var validate = require("aproba-browser")
function myfunc(a, b, c) {
// `a` must be a string, `b` a number, `c` a function
validate('SNF', arguments) // [a,b,c] is also valid
}
myfunc('test', 23, function () {}) // ok
myfunc(123, 23, function () {}) // type error
myfunc('test', 23) // missing arg error
myfunc('test', 23, function () {}, true) // too many args error
Valid types are:
type | description |
---|
Validation failures throw one of three exception types, distinguished by a
code
property of EMISSINGARG
, EINVALIDTYPE
or ETOOMANYARGS
.
If you pass in an invalid type then it will throw with a code of
EUNKNOWNTYPE
.
If an error argument is found and is not null then the remaining arguments will not be validated.
I wanted a very simple argument validator. It needed to do two things:
Be more concise and easier to use than assertions
Not encourage an infinite bikeshed of DSLs
This is why types are specified by a single character and there's no such thing as an optional argument.
This is not intended to validate user data. This is specifically about asserting the interface of your functions.
If you need greater validation, I encourage you to write them by hand or look elsewhere.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
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/28 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
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
60 existing vulnerabilities detected
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