Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

proy

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

proy

A streamlined form validation library


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Proy

A streamlined form validation library

Quick Start


$ yarn add proy

$ npm install proy

Usage

import { proy } from 'proy'

const descriptor = {
  name: {
    type: 'string',
    required: true,
    validator: (rule, val) => val === 'kanno',
  },
}

const basic = proy(descriptor)

basic.validate({ name: 'XeryYue' }, (err, fields) => {
  if (err) {
    errHandelr(err)
  }
})

API

Validate

function(source,(err,fields)):void

  • source : The object to validate (required).

  • callback: A callback function to invoke when validation completes .The callback will return a sync function

  • err: A error list

  • fields: A list of successfully verified data

descriptor


function(descriptor):Proy

  • descriptor : entry your validate rule
interface Rule {
  type: 'string' | 'number' | 'boolean' | 'array' | 'object';
  required?: boolean;
  validate?: (val: any) => boolean;
}

Procude

  • produce will interrupt the chain call.
  • produce will return successfully verified data , If un verifeid will return empty object .

LICENSE

MIT

Keywords

FAQs

Package last updated on 30 Nov 2021

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc