password

index.d.ts

A function to create a password policy.

password(rules: ...Array<function (str: string): (string | undefined)>): function (str: any): string
Parameters
rules (...Array<function (str: string): (string | undefined)>)
Returns
function (str: any): string: A string if there is an error, undefined otherwise.
min(num: number): function (str: any): string
Parameters
num (number)
Returns
function (str: any): string: A string if there is an error, undefined otherwise.
max(num: number): function (str: any): string
Parameters
num (number)
Returns
function (str: any): string: A string if there is an error, undefined otherwise.
has(charSet: string, num: number?, name: string?): function (str: any): string
Parameters
charSet (string) The characters to check for.
num (number?) The minimum characters required.
name (string?)
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

hasLowerCase

index.d.ts
hasLowerCase(num: number?): function (str: any): string
Parameters
num (number?) The minimum characters required.
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

hasUpperCase

index.d.ts
hasUpperCase(num: number?): function (str: any): string
Parameters
num (number?) The minimum characters required.
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

hasSpecial

index.d.ts
hasSpecial(num: number?): function (str: any): string
Parameters
num (number?) The minimum characters required.
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

hasDigit

index.d.ts
hasDigit(num: number?): function (str: any): string
Parameters
num (number?) The minimum characters required.
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

includes

index.d.ts
includes(requiredText: (string | Array<string>)): function (str: any): string
Parameters
requiredText ((string | Array<string>))
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

notIncludes

index.d.ts
notIncludes(requiredText: (string | Array<string>), substitute: (string | boolean | function (text: string): string)?): function (str: any): string
Parameters
requiredText ((string | Array<string>))
substitute ((string | boolean | function (text: string): string)?)
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

Checks if some of the rules were followed, if a number is included at the end, it will check if at least that many rules were followed.

some(rules: ...Array<(number | function (str: string): (string | undefined))>): function (str: any): string
Parameters
rules (...Array<(number | function (str: string): (string | undefined))>)
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

Inverts the result of a rule, allowing you to specify text.

not(rule: function (str: string): string, error: string): function (str: any): string
Parameters
rule (function (str: string): string)
error (string)
Returns
function (str: any): string: A string if there is an error, undefined otherwise.

template

index.d.ts

Parses the string template to make it simple to create templates. "$" is the magic symbol that lets you reference the argument. Only works with template functions with less than 10 arguments, and doesn't let you traverse (input to the function should be strings).

template(stringTemplate: string): function (...args: Array<string>): string
Parameters
stringTemplate (string)
Returns
function (...args: Array<string>): string