Skip to content

Commit

Permalink
export analyzepassword
Browse files Browse the repository at this point in the history
  • Loading branch information
THILAK6 committed Oct 1, 2024
1 parent 66ddd9c commit 802d31f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ Sanitizer | Description
**trim(input [, chars])** | trim characters (whitespace by default) from both sides of the input.
**unescape(input)** | replace HTML encoded entities with `<`, `>`, `&`, `'`, `"`, `` ` ``, `\` and `/`.
**whitelist(input, chars)** | remove characters that do not appear in the whitelist. The characters are used in a RegExp and so you will need to escape some chars, e.g. `whitelist(input, '\\[\\]')`.
**analyzePassword(str)** | Analyzes and returns details about the given string's composition as a password. Returns an object containing the password's length, count of unique characters, and the number of uppercase letters, lowercase letters, numbers, and symbols.

### XSS Sanitization

Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ import normalizeEmail from './lib/normalizeEmail';

import isSlug from './lib/isSlug';
import isLicensePlate from './lib/isLicensePlate';
import isStrongPassword from './lib/isStrongPassword';
import {isStrongPassword, analyzePassword} from './lib/isStrongPassword';

import isVAT from './lib/isVAT';

Expand Down Expand Up @@ -237,6 +237,7 @@ const validator = {
toString,
isSlug,
isStrongPassword,
analyzePassword,
isTaxID,
isDate,
isTime,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/isStrongPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function countChars(str) {
}

/* Return information about a password */
function analyzePassword(password) {
export default function analyzePassword(password) {
let charMap = countChars(password);
let analysis = {
length: password.length,
Expand Down

0 comments on commit 802d31f

Please sign in to comment.