Strings

Strings checks.

Methods

(inner) alpha(value) → {boolean}

Check if is alpha string

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.alpha('hello123456') // false

(inner) alphanumeric(value) → {boolean}

Check if is alphanumeric string

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.alphanumeric('hello123456') // true

(inner) camelCase(value) → {boolean}

Check if string is in camelCase format

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.camelCase('testTest') // true
be.camelCase('test_test') // false

(inner) capitalized(value) → {boolean}

Check if string is capitalized

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.capitalized('Hello World') // true
be.capitalized('hello world') // false

(inner) char(value) → {boolean}

Check if value is a single char

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.char('a') // true
be.char('ab') // false

(inner) contains(string, value) → {boolean}

Check if string contains a value

Interfaces: not, err

Source:
Parameters:
Name Type Description
string string

string

value string

string target

Returns:
Type:
boolean
Example
be.contains('hello', 'hello world') // true

(inner) emptyString(value) → {boolean}

Check if string is empty

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.emptyString('') // true

(inner) endWith(value, string, insensitive) → {boolean}

Check if string end with a value

Interfaces: not, err

Since:
  • 1.4.1
Source:
Parameters:
Name Type Description
value string

start string

string string

string target

insensitive boolean

case sensitive

Returns:
Type:
boolean
Example
be.endWith('world', 'hello world') // true
be.endWith('world', 'hello WORLD', true) // false

(inner) kebabCase(value) → {boolean}

Check if string is in kebab-case format

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.kebabCase('test-test') // true
be.kebabCase('testTest') // false

(inner) lowerCase(value) → {boolean}

Check if string is lower case

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.lowerCase('hello') // true

(inner) palindrome(value) → {boolean}

Check if a string is palindrome

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.palindrome('A but tuba') // true

(inner) similarity(string1, string2, threshold) → {boolean}

Check similarity between two string

Interfaces: not, err

Source:
Parameters:
Name Type Description
string1 string

string

string2 string

string target

threshold int | float

0 to 1

Returns:
Type:
boolean
Example
be.similarity('hello', 'hello', 1) // true
be.similarity('hello', 'hello world', 1) // false

(inner) snakeCase(value) → {boolean}

Check if string is in snake_case format

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.snakeCase('test_test') // true
be.snakeCase('testTest') // false

(inner) space(value) → {boolean}

Check if string is a space

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.space(' ') // true
be.space('a') // false

(inner) spaces(value) → {boolean}

Check if exists spaces in string

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.spaces('hello world') // true
be.spaces('helloworld') // false

(inner) startWith(value, string, insensitive) → {boolean}

Check if string start with a value

Interfaces: not, err

Source:
Parameters:
Name Type Description
value string

start string

string string

string target

insensitive boolean

case sensitive

Returns:
Type:
boolean
Example
be.startWith('hello', 'hello world') // true
be.startWith('hello', 'HELLO world', true) // false

(inner) stringLength(value, num) → {boolean}

Check string length

Interfaces: all, any, not, err

Since:
  • 1.13.0
Source:
Parameters:
Name Type Description
value string

string

num number
Returns:
Type:
boolean

(inner) stringRange(value, min, max) → {boolean}

Check string length range

Interfaces: not, err

Since:
  • 1.13.0
Source:
Parameters:
Name Type Default Description
value string

string

min number 0
max number
Returns:
Type:
boolean

(inner) upperCase(value) → {boolean}

Check if string is upper case

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.upperCase('HELLO') // true

(inner) word(value) → {boolean}

Check if is a word

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value string

string

Returns:
Type:
boolean
Example
be.word('hello') // true
be.word('hello world') // false