
Security News
Feross on Risky Business Weekly Podcast: npm’s Ongoing Supply Chain Attacks
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
builder-validation
Advanced tools
Builder validation is a library that provides classes to build and validate objects against a schemas. It can be useful if you don't want to define your own regexes or functions to validate objects.
This library is also a part of the express-custom library, which is what this library was originally made for.
Warning: This library is still in development and is not ready for production use. There may be breaking changes in the future.
# Using npm
> npm install builder-validation
# Using yarn or pnpm
> yarn/pnpm add builder-validation
This library supports both typescript and javascript, with ES6 modules and CommonJS.
// ES6 modules
import { Schema } from 'builder-validation';
// CommonJS
const { Schema } = require('builder-validation');
The first step is to create the schema. The schema is the object that will be used to validate the object.
const schema = new Schema()
.addString({
name: 'username',
required: true,
minLength: 3,
maxLength: 16,
})
.addString({
name: 'password',
required: true,
minLength: 8,
maxLength: 32,
});
schema.validate({
username: 'slekup',
password: 'password',
});
If you have any issues or would like to contribute, please open an issue or pull request.
Copyright © slekup
FAQs
Use classes to validate objects.
We found that builder-validation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.