Utility

Methods

(static) length(object) → {Number}

Source:
Since:
  • 0.1.0

Get length of an object.

Example
length([1, 2, 3]); // => 3
Parameters:
Name Type Description
object *
Returns:

Lenght of an object.

Type
Number

(static) random_number(minopt, maxopt) → {Number}

Source:
Since:
  • 0.1.0

Returns a random integer between min and max. (inclusive) If you only pass one argument, it will return a number between 0 and that number. By default random number range is between 0 and 100.

Examples
random_number()
// => returns an integer between 0 and 100
random_number(50)
// => returns an integer between 0 and 50
random_number(50, 200)
// => returns an integer between 50 and 200
Parameters:
Name Type Attributes Default Description
min Number <optional>
0

A minimum posible number generated.

max Number <optional>
100

A maximum posible number generated.

Returns:

Returns the random number.

Type
Number

(static) random_string(lengthopt) → {String}

Source:
Since:
  • 0.1.0

Generate random string n characters long. If string length is not provided default string length will be 20.

Example
random_string(); // => BTe29*4_tPk90+mmSj%@
random_string(5); // => Fe9!o
Parameters:
Name Type Attributes Default Description
length Number <optional>
20

String length.

Returns:

Generated string of n characters.

Type
String

(static) typeOf(valueopt) → {String}

Source:
Since:
  • 0.1.0

Return type of provided value. Prevent pitfall types such as NaN, null, []

Examples
type(null)
// => 'null'
type([1, 2, 3])
// => 'array'
type(NaN)
// => 'NaN
Parameters:
Name Type Attributes Default Description
value mix <optional>
'undefined'

Checked value.

Returns:

A type of value.

Type
String