
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
flood-gate
Advanced tools
Floodgate validator is a Typescript validaton library based on decorators.
npm install floodgate --save
npm install -g mocha && mocha
import { Schema, Str, Nr, SchemaStore, Arr, Child , SchemaMode, Email, Child } from "floodgate";
@Schema({ mode: SchemaMode.STRICT })
class Person{
@Str({ minLength: 3, maxLength: 4 })
name: string;
@Nr({ min: 1 , allowDecimals: false})
age: number;
@Email()
email: string;
@Child({ type: Pet })
favoritePet: Pet;
@Arr({ child: Pet })
otherPets: Pet[];
@Arr({ child: Str({ minLength: 3, trim: true }) })
tags: string[];
}
@Schema({ mode: SchemaMode.STRICT })
class Pet{
@Str({ minLength: 3, maxLength: 4 })
name: string;
@Nr({ min: 1 , allowDecimals: false})
age: number;
}
// Behaves like a normal class
let person = new Person();
// Modify....
// Validate
SchemaStore.validate(person,(err,person) => {
// Err contains a ValidationError or is null
// Person is the validated schema, which may have been modified depending on your configuration
});
SchemaMode.STRICT only allows specified properties on an object. Not more not less.SchemaMode.LOOSE only checks specified properties. Leaves other properties as they are.SchemaMode.SHORTEN only checks specified properties. Removes all unknown properties silently.@Nr(options) ensures a value is a number@Bool(options) ensures a value is a boolean@Str(options) ensures a value is a string@Email(options) ensures a value is an email address@Arr({ child: Type ... }) ensures a value is an array of given type@Child({ type: Type ... }) ensures a value is an object based on another schemaFAQs
A typescript object validation library using decorators
The npm package flood-gate receives a total of 3 weekly downloads. As such, flood-gate popularity was classified as not popular.
We found that flood-gate 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.