Methods

static

arr(value) → Array

Casts a value to an array. If value is a number, an array of length value will be created

Parameter

Name Type Optional Description

value

any

 

Value to cast

Returns

Array 

static

bool(value) → boolean

Casts a value to a boolean (alias for Boolean constructor)

Parameter

Name Type Optional Description

value

any

 

Value to cast

Returns

boolean 

static

int(value) → number

Casts a value to an integer using parseInt. If value is a string an int will be extracted with regex before casting).

Parameter

Name Type Optional Description

value

any

 

Value to cast

Returns

number 

static

num(value) → number

Casts a value to a number using the Number constructor. If value is a string then a number will be extracted with regex before casting.

Parameter

Name Type Optional Description

value

any

 

Returns

number 

static

str(value)

Casts a value to a string. If value is an array, it will be joined by "".

Parameter

Name Type Optional Description

value

any

 

Value to cast