passguard
v1.0.3
Published
This is The Npm Package for Password Validations in Js Forms
Downloads
3
Readme
passGuard
passGuard is a simple npm package for validating passwords against specified criteria.
Installation
You can install passGuard using npm:
npm install passguard
Usage
const passGuard = require('passguard');
// Validate password
const isValid = passGuard('StrongPass123!', 8, true, true);
console.log(isValid); // true
API
passGuard(password, minimalLength, containUpper, containSpecial)
Validates a password against specified criteria.
password
(string): The password to validate.minimalLength
(number): The minimum length required for the password.containUpper
(boolean): Whether the password should contain at least one uppercase letter.containSpecial
(boolean): Whether the password should contain at least one special character.
Returns true
if the password meets all the specified criteria, otherwise false
.
Example
const passGuard = require('passguard');
// Validate password
const isValid = passGuard('StrongPass123!', 8, true, true);
console.log(isValid); // true