UNPKG

@euk-labs/beltz

Version:

![npm](https://img.shields.io/npm/v/@euk-labs/beltz) ![NPM](https://img.shields.io/npm/l/@euk-labs/beltz) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/Eureka-Shoulders/beltz/CI) ![npm](https://img.shields.io/npm/dw/@euk-labs/bel

29 lines 1.03 kB
"use strict"; /** * * @param password string to be verified * @returns null if valid or array of improvement points */ Object.defineProperty(exports, "__esModule", { value: true }); exports.findPasswordFlaws = void 0; function findPasswordFlaws(password) { const reasons = []; if (password.length < 8) { reasons.push('Password must be at least 8 characters long'); } if (password.search(/[a-z]/) === -1) { reasons.push('Password must contain at least one lowercase letter'); } if (password.search(/[A-Z]/) === -1) { reasons.push('Password must contain at least one uppercase letter'); } if (password.search(/[0-9]/) === -1) { reasons.push('Password must contain at least one number'); } if (password.search(/[^a-zA-Z0-9]/) === -1) { reasons.push('Password must contain at least one special character'); } return reasons.length ? reasons : null; } exports.findPasswordFlaws = findPasswordFlaws; //# sourceMappingURL=findPasswordFlaws.js.map