Skip to content

API v2.2.0

Tarun Batra edited this page Apr 30, 2017 · 1 revision

PasswordSchema

Kind: global class

new PasswordSchema()

Creates a password-validator schema

passwordSchema.validate(pwd, options) ⇒ boolean | array

Method to validate the password against schema

Kind: instance method of PasswordSchema
Returns: boolean | array - Boolean value indicting the validity of the password as per schema, if 'options.list' is not set. Otherwise, it returns an array of property names which failed validations

Param Type Description
pwd string password to valdiate
options object optional options to configure validation
[options.list] boolean asks for a list of validation failures instead of just true/false

passwordSchema.not()

Rule to invert the next applied rules. All the rules applied after 'not' will have opposite effect, until 'has' rule is applied

Kind: instance method of PasswordSchema

passwordSchema.has()

Rule to invert the effects of 'not' Apart from that, 'has' is also used for decoratvie purposes

Kind: instance method of PasswordSchema

passwordSchema.isMin(num)

Rule to specify a minimum length of the password

Kind: instance method of PasswordSchema

Param Type Description
num number minimum length

passwordSchema.isMax(num)

Rule to specify a maximum length of the password

Kind: instance method of PasswordSchema

Param Type Description
num number maximum length

passwordSchema.digits()

Rule to mendate the presense of digits in the password

Kind: instance method of PasswordSchema

passwordSchema.letters()

Rule to mendate the presense of letters in the password

Kind: instance method of PasswordSchema

passwordSchema.uppercase()

Rule to mendate the presense of uppercase letters in the password

Kind: instance method of PasswordSchema

passwordSchema.lowercase()

Rule to mendate the presense of lowercase letters in the password

Kind: instance method of PasswordSchema

passwordSchema.symbols()

Rule to mendate the presense of symbols in the password

Kind: instance method of PasswordSchema

passwordSchema.spaces()

Rule to mendate the presense of space in the password It can be used along with 'not' to not allow spaces in the password

Kind: instance method of PasswordSchema