Gathering detailed insights and metrics for @alifd/validate
Gathering detailed insights and metrics for @alifd/validate
Gathering detailed insights and metrics for @alifd/validate
Gathering detailed insights and metrics for @alifd/validate
npm install @alifd/validate
Typescript
Module System
Node Version
NPM Version
TypeScript (99.36%)
JavaScript (0.64%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
82 Commits
3 Forks
2 Watchers
27 Branches
11 Contributors
Updated on Jan 31, 2024
Latest Version
1.4.0
Package Id
@alifd/validate@1.4.0
Unpacked Size
95.76 kB
Size
24.45 kB
File Count
19
NPM Version
7.20.2
Node Version
14.17.1
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
22
Validation to be used with @alifd/field
Install with npm install @alifd/validate
const rules = {
myInput: function (rule, value, cb, options) {
if (value <= 100) {
cb('Value must be more than 100');
} else {
cb();
}
}
}
const validator = new Validator(rules);
validator.validate({ myInput: 90 }, (err) => { console.log(err)});
const rules = {
myInput: function (rule, value, cb, options) {
if (value <= 100) {
cb('Value must be more than 100');
} else {
cb();
}
}
}
const validator = new Validator(rules);
validator.validatePromise({ myInput: 90 })
.then((err) => { console.log(err)})
let validator = new Validator(rules [, options]);
Parameter | Description | Type | Optional | Default |
---|---|---|---|---|
rules | Map of rule names to validation functions | { [ruleName] : Array of validation functions } | yes | undefined |
options | validation options | Object | yes | {} |
options
configuration item
Parameters | Description | Type | Default |
---|---|---|---|
first | should only return the first error found amongst rules | Boolean | undefined |
messages | map to override default messages | Object | (see ./src/messages) |
npm run test
- triggers a one-time full run of all unit tests
npm run test-watch
- triggers a run of all unit tests, but watches for any changes to code or tests and reruns all tests.
Commits must be in the following format TYPE(SCOPE): MESSAGE
, where SCOPE
is optional.
e.g. fix: validatePromise return value
Review the commitlint.config.js
file to see allowed types.
There are 2 main branches: Master and Develop. Master holds the latest code that is contained in the npm package. Develop is the development branch used for queueing package changes and any final validation. All development should occur on another branch and then be merged into Develop.
Travis CI will run tests on each pull request and push. If the push is to master then an additional release step runs. The release step uses semantic-release
to determine the correct version, tag the master branch, and release the new package to npm.
NOTE: the package.json file needs to be updated manually after the release.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/16 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
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
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
27 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