Skip to content

Latest commit

History

History
83 lines (58 loc) 路 1.71 KB

string.md

File metadata and controls

83 lines (58 loc) 路 1.71 KB

String

import {string} from 'valid.js'

isString

Checks for a 'String'

Usage

import {validate, string} from 'valid.js'

let isvalid = validate(string.isString)
let result = isvalid('Test ValidateJS')
// result => true

minLength(value)

Validates the size of the 'string' is greater than or equal to (>=) the value

Usage

import {validate, string} from 'valid.js'

let isvalid = validate(string.minLength(15))
let result = isvalid('Test ValidateJS')
// result => true
let resultFalse = isvalid('TestValidateJS')
// resultFalse => false

maxLength(value)

Validates the size of the 'string' is less than or equal to (<=) the value

Usage

import {validate, string} from 'valid.js'

let isvalid = validate(string.maxLength(15))
let result = isvalid('Test ValidateJS')
// result => true
let resultFalse = isvalid('Test ValidateJS Brazil')
// resultFalse => false

length(minValue, maxValue)

Validates that the length of the string is within the range

Usage

import {validate, string} from 'valid.js'

let isvalid = validate(string.length(10, 15))
let result = isvalid('Test ValidateJS')
// result => true
let resultFalse = isvalid('Test ValidateJS Brazil')
// resultFalse => false

regex(expression, lastIndex)

Validate regular expressions

Usage

import {validate, string} from 'valid.js'

let isvalid = validate(string.regex(/a/))
let result = isvalid('Test ValidateJS')
// result => true
let resultFalse = isvalid('Test VlidteJS Brzil')
// resultFalse => false

.