UNPKG

@randyd45/curp-validation

Version:

a simple package for curp validation

47 lines (38 loc) 1.51 kB
# Curp validation usage ## CURP object To star using this library you must import the module and instantiate a new CURP object like this. ```js import {CURP} from "curp-validation"; let curp = new CURP("CUAJ980602MQRRRSXX"); ``` The curp object is the main class that handles all the name, lastname and birthday verification. ## Valid format This functionality verifies that the CURP input has a valid state, birthday, sex, and overall valid format. the function returns a true if the input is valid and false otherwise. ```js curp.isFormatValid() ``` ## Valid name this functionality verifies if the name is valid accoding to the CURP input, this function returns true if it is valid and false otherwise. ```js curp.isNameValid("MARIA JOSE") ``` ## Valid lastname this functionality verifies if the lastname is valid accoding to the CURP input, this function returns true if it is valid and false otherwise. ```js curp.isFirstLastnameValid("DE LA CRUZ") ``` ## Valid second lastname this functionality verifies if the second lastname is valid accoding to the CURP input, this function returns true if it is valid and false otherwise. ```js curp.isSecondLastnameValid("ARELLANO") ``` ## Valid birthday this functionality verifies if a birthday is valid accoding to the CURP input, this function returns true if it is valid and false otherwise. ```js curp.isBirthdayValid(98, 6, 2) ``` ## Extract birthday this functionality extracts the birthday of the input curp. ```js curp.extractBirthday() ```