Socket
Book a DemoInstallSign in
Socket

builder-validation

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

builder-validation

Use classes to validate objects.

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Builder Validation Logo

Express CustomDiscordGitHub

Use classes to validate objects with ease.

Discord Server NPM Version NPM Downloads Test Status NPM Size

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.

Installation

# Using npm
> npm install builder-validation
# Using yarn or pnpm
> yarn/pnpm add builder-validation

Usage

Importing

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');

Create the Schema

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,
  });

Validate an object

schema.validate({
  username: 'slekup',
  password: 'password',
});

Issues and Contributing

If you have any issues or would like to contribute, please open an issue or pull request.

License

Copyright © slekup

Keywords

nodejs

FAQs

Package last updated on 02 Jul 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.