@book-junction/patterns
v1.2.1
Published
A repository for commonly used patterns
Maintainers
Readme
Book Junction Patterns
- Author: Gaurav Sahitya
- Version: v1.2
About
This package contains all patterns commonly used in web and mobile development projects. Patterns defined in this package are divided into following categories
- Commons
- Personal Identification (PI)
Installation
Please follow these steps to install this package into your project.
npm install @book-junction/patternsNote: This command requires Node.js; please install the latest version from its official website before running it.
Usage
Let's see the paterns which are defined in the commons category.
// Importing
const Patterns = require('@book-junction/patterns');
// For checking name
const name = Patterns.common.name.test('Gaurav Sahitya'); // true
// For checking email
const email = Patterns.common.email.test('[email protected]'); // true
// For checking phone number
const phone = Patterns.common.phone.test('+919646560934'); //true
// For checking password
const password = Patterns.common.password.test('tesTing!23'); //true
// For checking date of birth
const dob = Patterns.common.dob.test('1999-07-30'); //trueNow let's see the patterns which are defined in the personal identification category (pi)
// Importing
const Patterns = require('@book-junction/patterns');
//Aadhar number
const aadharNumber = Patterns.pi.aadharNumber.test('7914-8520-1234'); // true
//Pan number
const panNumber = Patterns.pi.panNumber.test('LOTCS1963W'); // true
//Voter id number
const voterNumber = Patterns.pi.voterIdNumber.test('LAZ1775211'); // true
//Passport number
const passportNumber = Patterns.pi.passportNumber.test('M8765432'); // true
Points to consider
- Password must be atleast 8 characters and atmost 32 characters long. It should also contain atleast one uppercase letter, one lowercase letter, one digit and one special character.
- All email clients are supported by this package.
- This package is a commonjs node package.
Know more about author
Hello my name is Gaurav Sahitya - the author of this package. I'm a software engineer currently working at C-DAC (Meity, GoI). I have more than 2.5 years of experience of developing software systems, websites etc. For more information please visit my profile. Please follow me on Linkedin and Github.
