Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 489 Bytes

README.md

File metadata and controls

28 lines (19 loc) · 489 Bytes

validators

A simple module(no dependency) to validate username, email and more for Feeds Pub.

Reusable on frontend and backend.

Install

npm install validators

Usage

const { isEmail, isUsername, isPassword } = require('@feedspub/validators');

// true
isEmail('[email protected]');
isUsername('timqian');
isPassword('fidslde');

Validating Rules

  • email: /\S+@\S+\.\S+/
  • username: /^[a-zA-Z0-9\-\_]+$/
  • password: length > 6