Skip to content

Latest commit

 

History

History
776 lines (531 loc) · 30.6 KB

DOCS.md

File metadata and controls

776 lines (531 loc) · 30.6 KB

Modules

Date Validators
General Validators
Patterns
Pesel Validators
Phone Number Validators

Date Validators

  • [Date Validators](#module_Date Validators)
    • [.isDateValidator](#module_Date Validators.isDateValidator) ⇒ boolean
    • [.isDateNotUnder18Validator](#module_Date Validators.isDateNotUnder18Validator) ⇒ boolean
    • [.isBirthDateValidator](#module_Date Validators.isBirthDateValidator) ⇒ boolean
    • [.isAfterTodayValidator](#module_Date Validators.isAfterTodayValidator) ⇒ boolean
    • [.isBeforeTodayValidator](#module_Date Validators.isBeforeTodayValidator) ⇒ boolean
    • [.isExpiryDateValidator](#module_Date Validators.isExpiryDateValidator) ⇒ boolean
    • [.isReleaseDateValidator](#module_Date Validators.isReleaseDateValidator) ⇒ boolean

Date Validators.isDateValidator ⇒ boolean

Checks if value is valid date in format YYYY-MM-DD. Validates also number of days per month

Kind: static property of [Date Validators](#module_Date Validators)

Param Type Description
value string

value to check.

Date Validators.isDateNotUnder18Validator ⇒ boolean

Checks if person with given birthday is above 18 years. Date in format YYYY-MM-DD

Kind: static property of [Date Validators](#module_Date Validators)

Param Type Description
date string

value to check.

Date Validators.isBirthDateValidator ⇒ boolean

Checks if value is valid birth date. Assumes that human cannot be older than 150 years. Date in format YYYY-MM-DD

Kind: static property of [Date Validators](#module_Date Validators)

Param Type Description
date string

value to check.

Date Validators.isAfterTodayValidator ⇒ boolean

Checks if given date is after today. Date in format YYYY-MM-DD

Kind: static property of [Date Validators](#module_Date Validators)

Param Type Description
date string

value to check.

Date Validators.isBeforeTodayValidator ⇒ boolean

Checks if given date is before today. Date in format YYYY-MM-DD

Kind: static property of [Date Validators](#module_Date Validators)

Param Type Description
date string

value to check.

Date Validators.isExpiryDateValidator ⇒ boolean

Checks if given expiration date of id card is valid. Checks if given date is later or equal to today and if given date is smaller than current date plus 100 years. Date in format YYYY-MM-DD

Kind: static property of [Date Validators](#module_Date Validators)

Param Type Description
date string

value to check.

Date Validators.isReleaseDateValidator ⇒ boolean

Checks if given release date of id card is valid. Checks if given date is earlier or equal to today and if given date is bigger than current date minus 100 years. You can also pass expiration date and if it's given then it is checked if expiration date is later than release date. Date in format YYYY-MM-DD

Kind: static property of [Date Validators](#module_Date Validators)

Param Type Description
date string

value to check.

expiryDate string

acc.

General Validators

  • [General Validators](#module_General Validators)
    • [.isValueValidator](#module_General Validators.isValueValidator) ⇒ boolean
    • [.isNotNullValidator](#module_General Validators.isNotNullValidator) ⇒ boolean
    • [.isNotUndefinedValidator](#module_General Validators.isNotUndefinedValidator) ⇒ boolean
    • [.isNotEmptyUnlessValidator](#module_General Validators.isNotEmptyUnlessValidator) ⇒ boolean
    • [.isNotEmptyStringValidator](#module_General Validators.isNotEmptyStringValidator) ⇒ boolean
    • [.isNotEmptyTrimmedStringValidator](#module_General Validators.isNotEmptyTrimmedStringValidator) ⇒ boolean
    • [.isSelectedValidator](#module_General Validators.isSelectedValidator) ⇒ boolean
    • [.isNipValidator](#module_General Validators.isNipValidator) ⇒ boolean
    • [.isPostalCodeValidator](#module_General Validators.isPostalCodeValidator) ⇒ boolean
    • [.isPasswordValidator](#module_General Validators.isPasswordValidator) ⇒ boolean
    • [.isNotSmallerValidator](#module_General Validators.isNotSmallerValidator) ⇒ boolean
    • [.isNotSmallerOrEqualValidator](#module_General Validators.isNotSmallerOrEqualValidator) ⇒ boolean
    • [.isNotHigherValidator](#module_General Validators.isNotHigherValidator) ⇒ boolean
    • [.isNotHigherOrEqualValidator](#module_General Validators.isNotHigherOrEqualValidator) ⇒ boolean
    • [.isEmailValidator](#module_General Validators.isEmailValidator) ⇒ boolean
    • [.isMinLengthValidator](#module_General Validators.isMinLengthValidator) ⇒ boolean
    • [.isMaxLengthValidator](#module_General Validators.isMaxLengthValidator) ⇒ boolean
    • [.isSameAsValidator](#module_General Validators.isSameAsValidator) ⇒ boolean
    • [.isOtherThanValidator](#module_General Validators.isOtherThanValidator) ⇒ boolean
    • [.isIbanValidator](#module_General Validators.isIbanValidator) ⇒ boolean
    • [.isIbanLengthValidator](#module_General Validators.isIbanLengthValidator) ⇒ boolean
    • [.isLanNumberValidator](#module_General Validators.isLanNumberValidator) ⇒ boolean
    • [.isRoutingCodeValidator](#module_General Validators.isRoutingCodeValidator) ⇒ boolean
    • [.isTaxNumberValidator](#module_General Validators.isTaxNumberValidator) ⇒ boolean
    • [.isSwiftValidator](#module_General Validators.isSwiftValidator) ⇒ boolean
    • [.isSwiftCountryValidator](#module_General Validators.isSwiftCountryValidator) ⇒ boolean
    • [.isIdNumberValidator](#module_General Validators.isIdNumberValidator) ⇒ boolean
    • [.isPassportValidator](#module_General Validators.isPassportValidator) ⇒ boolean
    • [.isPropValidator](#module_General Validators.isPropValidator) ⇒ boolean
    • [.isAllKeysValidator](#module_General Validators.isAllKeysValidator) ⇒ boolean
    • [.isLatinValidator](#module_General Validators.isLatinValidator) ⇒ boolean

General Validators.isValueValidator ⇒ boolean

Checks if any proper value was given

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value any

value to check.

General Validators.isNotNullValidator ⇒ boolean

Checks if value is not null

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value any

value to check.

General Validators.isNotUndefinedValidator ⇒ boolean

Checks if value is not undefined

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value any

value to check.

General Validators.isNotEmptyUnlessValidator ⇒ boolean

Checks if value was given unless can be empty.

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

canBeEmpty boolean

if true validation is ignored

General Validators.isNotEmptyStringValidator ⇒ boolean

Checks if value is not empty string

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value any

value to check.

General Validators.isNotEmptyTrimmedStringValidator ⇒ boolean

Checks if value is not empty string after trim

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

General Validators.isSelectedValidator ⇒ boolean

Checks if any option was chosen. Created for select2 library

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string | boolean

value to check.

General Validators.isNipValidator ⇒ boolean

Checks if value is valid nip number

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

General Validators.isPostalCodeValidator ⇒ boolean

Checks if value is valid polish or chinese postal code

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

country string

country of postal code.

General Validators.isPasswordValidator ⇒ boolean

Checks if value is valid password with 8 signs

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

General Validators.isNotSmallerValidator ⇒ boolean

Checks if value is smaller than given minimal value

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

minValue string

minimal value.

General Validators.isNotSmallerOrEqualValidator ⇒ boolean

Checks if value is smaller or equal than given minimal value

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

minValue string

minimal value.

General Validators.isNotHigherValidator ⇒ boolean

Checks if value is higher than given maximal value

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

maxValue string

maximal value.

General Validators.isNotHigherOrEqualValidator ⇒ boolean

Checks if value is higher or equal than given maximal value

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

maxValue string

maximal value.

General Validators.isEmailValidator ⇒ boolean

Checks if value is valid email. Based on w3.org

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

General Validators.isMinLengthValidator ⇒ boolean

Checks if value has smaller or equal length than given minimal length

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

minLength string

minimal length.

General Validators.isMaxLengthValidator ⇒ boolean

Checks if value has bigger or equal length than given maximal length

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

maxLength string

maximal length.

General Validators.isSameAsValidator ⇒ boolean

Checks if value is equal to other value

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

otherValue string

other value to check.

General Validators.isOtherThanValidator ⇒ boolean

Checks if value is not equal to other value

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

otherValue string

other value to check.

General Validators.isIbanValidator ⇒ boolean

Checks if value is valid iban number

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

countryCode CountryCode

country code.

General Validators.isIbanLengthValidator ⇒ boolean

Checks if value is valid iban number

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

countryCode CountryCode

country code.

General Validators.isLanNumberValidator ⇒ boolean

Checks if value is valid non-iban account number

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

[country] string

optional country to check.

General Validators.isRoutingCodeValidator ⇒ boolean

Checks if value is valid routing code

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

[country] string

optional country to check.

General Validators.isTaxNumberValidator ⇒ boolean

Checks if value is valid tax number

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

[country] string

optional country to check.

[isCompany] boolean

optional isCompany to check.

General Validators.isSwiftValidator ⇒ boolean

Checks if value is valid swift number

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

General Validators.isSwiftCountryValidator ⇒ boolean

Checks if given country is equal to country taken from swift

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
swift string

swift to check.

country string

country to compare.

General Validators.isIdNumberValidator ⇒ boolean

Checks if value is valid polish id number

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

General Validators.isPassportValidator ⇒ boolean

Checks if value is valid polish passport number

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

General Validators.isPropValidator ⇒ boolean

Checks if given object has property valid and if it is equal to true

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value Object

value to check.

General Validators.isAllKeysValidator ⇒ boolean

Checks if given object has all keys

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
object object

value to check.

expectedKeys Array.<string>

array of expected keys.

General Validators.isLatinValidator ⇒ boolean

Checks if value is in Latin alphabet or matches any kind of punctuation character or matches any math symbols, currency signs, dingbats, box-drawing characters, etc

Kind: static property of [General Validators](#module_General Validators)

Param Type Description
value string

value to check.

Patterns

Patterns.isAccountNumberPattern ⇒ boolean

Checks if value matches account number pattern

 /^[a-zA-Z0-9\\s]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isAccountTypeOtherPattern ⇒ boolean

Checks if value matches account type pattern

 /^[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ. ]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isAlphaNumericPattern ⇒ boolean

Checks if value matches alpha numeric pattern

 /^[a-zA-Z0-9]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isCityPattern ⇒ boolean

Checks if value matches city pattern

 /^([a-zA-Z\u0080-\u024F]+(?:. |-| |'))*[a-zA-Z\u0080-\u024F]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isGenericTextPattern ⇒ boolean

Checks if value matches generic text pattern

 /^[0-9a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ\s\,\.\-\+\(\)\!\?\:

Kind: static property of Patterns
\n]*$/:

Param Type Description
value string

value to check.

Patterns.isLastNamePattern ⇒ boolean

Checks if value matches last name pattern

 /^[a-zA-Z\u00C0-\u017F\-\s\']*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isNamePattern ⇒ boolean

Checks if value matches name pattern

 /^[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ ]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isNipPattern ⇒ boolean

Checks if value matches nip pattern

 /^[a-zA-Z0-9\s\-]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isNumericPattern ⇒ boolean

Checks if value matches numeric pattern

 /^[0-9]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isPasswordPattern ⇒ boolean

Checks if value matches password pattern

 /^[0-9a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ\s\-\+\_\\!

Kind: static property of Patterns
#$%^&*|&quot;&#x27;;:,.?()[]{}]*$/:

Param Type Description
value string

value to check.

Patterns.isBankAccountNamePattern ⇒ boolean

Checks if value matches bank account name pattern

  /^[0-9a-zA-Z\u00C0-\u017F\xad\xa0\u201c\u201d\u201e\u201f\u2013\_\;\'

Kind: static property of Patterns
-\s&quot;,./-+&amp;()]*$/:

Param Type Description
value string

value to check.

Patterns.isCharsCompanyPattern ⇒ boolean

Checks if value matches company name pattern

  /^[a-zA-Z0-9\u00C0-\u017F\xad\xa0\u201c\u201d\u201e\u201f\u2013\_\;

Kind: static property of Patterns
-\s.,&amp;&#x60;&#x27;:()!*&quot;/\+]*$/:

Param Type Description
value string

value to check.

Patterns.isPostalCodePattern ⇒ boolean

Checks if value matches postal code pattern

 /^[a-zA-Z0-9 \-]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isStreetPattern ⇒ boolean

Checks if value matches street name pattern

 /^[0-9a-zA-Z\u00C0-\u017F\-\s\.,\/]*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Patterns.isPolishStreetPattern ⇒ boolean

Checks if value matches pattern

 /[a-zA-Z\\u00C0-\\u017F]+\\s\\d.*$/ 

Kind: static property of Patterns

Param Type Description
value string

value to check.

Pesel Validators

  • [Pesel Validators](#module_Pesel Validators)
    • [.isPeselNotUnder18Validator](#module_Pesel Validators.isPeselNotUnder18Validator) ⇒ boolean
    • [.isPeselValidator](#module_Pesel Validators.isPeselValidator) ⇒ boolean

Pesel Validators.isPeselNotUnder18Validator ⇒ boolean

Checks if person with given pesel is above 18 years

Kind: static property of [Pesel Validators](#module_Pesel Validators)

Param Type Description
value string

value to check.

Pesel Validators.isPeselValidator ⇒ boolean

Checks if value is valid pesel number. Also accepts *********** as anonymized pesel

Kind: static property of [Pesel Validators](#module_Pesel Validators)

Param Type Description
value string

value to check.

Phone Number Validators

  • [Phone Number Validators](#module_Phone Number Validators)
    • [.isPhoneValidator](#module_Phone Number Validators.isPhoneValidator) ⇒ boolean
    • [.isMobilePhoneValidator](#module_Phone Number Validators.isMobilePhoneValidator) ⇒ boolean

Phone Number Validators.isPhoneValidator ⇒ boolean

Checks if value is valid phone number. Based on google libphonenumber

Kind: static property of [Phone Number Validators](#module_Phone Number Validators)

Param Type Description
value string

value to check.

countryCode CountryCode

country code.

Phone Number Validators.isMobilePhoneValidator ⇒ boolean

Checks if value is valid mobile phone number. Based on google libphonenumber

Kind: static property of [Phone Number Validators](#module_Phone Number Validators)

Param Type Description
value string

value to check.

countryCode CountryCode

country code.