Assertion

Methods

(static) in_array(array, value) → {Boolean}

Source:

Determines if collection contain value.

Examples
in_array([1, 2, 3, 4], 3)
// => true
in_array([2, 4, 5, 2, 1], 6)
// => false
Parameters:
Name Type Description
array Array

Collection in which the value is searched.

value *

Searched value.

Returns:

Truthfulness of the contents.

Type
Boolean

(static) is_array(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an array.

Example
is_array([1, 2, 3]); // => true
(function() { return is_array(arguments); })(); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an array, otherwise false.

Type
Boolean

(static) is_arrayLike(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an array-like.

For a object to be array-like it must meet following conditions.

  • Must not be a function.
  • Must not be null.
  • Must contain length property.
  • Lenght must be in range between 0 and Number.MAX_SAFE_INTEGER
Example
is_arrayLike([1, 2, 3]); // => true
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is array-like, otherwise false.

Type
Boolean

(static) is_boolean(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an boolean.

Example
is_boolean(false) // => true
is_boolean(0); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an boolean, otherwise false.

Type
Boolean

(static) is_date(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an Date object.

Example
const date = new Date();

is_date(date); // => true
is_date(new Date().getYear()); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is Date object, otherwise false.

Type
Boolean

(static) is_defined(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is not null or undefined.

Example
const Person = {
    a: 10
};

is_defined(Person.a); // => true
is_defined(Person.b); // => false
is_defined(void 0); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is defined, otherwise false.

Type
Boolean

(static) is_email(email) → {Boolean}

Source:
Since:
  • 0.1.0
See:

A function that determines whether email matches RFC 5322 RFC 5321 and RFC 3696 or not. Using regexp that covers 99% of email addresses.

Example
is_email('simple@example.com'); // => true
is_email('john.doe@example..com'); // => false
Parameters:
Name Type Description
email String

Email string to check.

Returns:

true if the value is a valid email address, otherwise false.

Type
Boolean

(static) is_finite(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is finite.

Example
is_finite(55555555); // => true
is_finite(1 / 0); // => false
is_finite(-1 / 0); // => false
Parameters:
Name Type Description
value *

Value to check.

Returns:

true if the value is finite, otherwise false.

Type
Boolean

(static) is_function(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an function.

Example
is_function(is_boolean) // => true
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an function, otherwise false.

Type
Boolean

(static) is_integer(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is integer.

Example
is_integer(4); // => true
is_integer(4.0); // => true
is_integer(4.0001); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an integer, otherwise false.

Type
Boolean

(static) is_json(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines if a value is valid JSON string.

Example
const ajaxData = {
    url: www.linkedin.com/in/stefan-lazarevic
};

is_json(JSON.stringify(ajaxData)); // => true
is_json("Hello World"); // => false
is_json(ajaxData); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is a valid JSON string, otherwise false.

Type
Boolean

(static) is_nan(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is not a number. (NaN)

Example
is_nan(1 / 'a'); // => true
is_nan('a'); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is NaN, otherwise false.

Type
Boolean

(static) is_null(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an null.

Example
is_null(null); // => true
is_null(void 0); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is null, otherwise false.

Type
Boolean

(static) is_number(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is a number.

Example
is_number('10'); // => false
is_number(42.44); // => true
is_number(NaN); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is a number, otherwise false.

Type
Boolean

(static) is_numeric(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is numeric.

Apply strict check on numbers and strings only. Excluding boolean values and cooersive values.

Example
is_numeric('123'); // => true
is_numeric('1e10000'); // => true
is_numeric('10px'); // => false
Parameters:
Name Type Description
value *

Value to check.

Returns:

true if the value is numeric, otherwise false.

Type
Boolean

(static) is_object(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an object.

Example
function Coordinate(x = 0, y = 0) {
    this.x = x;
    this.y = y;
}

is_object(new Coordinate(10, 15)); // => true
is_object({ 'x': 0, 'y': 0 }); // => true
is_object([1, 2, 3]); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an object, otherwise false.

Type
Boolean

(static) is_objectLike(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an object-like.

Example
function Coordinate(x = 0, y = 0) {
    this.x = x;
    this.y = y;
}

is_object(new Coordinate(10, 15)); // => true
is_object({ 'x': 0, 'y': 0 }); // => true
is_object([1, 2, 3]); // => true
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an object-like, otherwise false.

Type
Boolean

(static) is_regexp(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines if a value is valid regexp.

Example
is_regexp(/abc/g); // => true
is_regexp(new RegExp('abc', 'g')); // => true
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an RegExp, otherwise false.

Type
Boolean

(static) is_string(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is an strict string.

Example
is_string("Hello World!"); // => true
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an string, otherwise false.

Type
Boolean

(static) is_symbol(value) → {Boolean}

Source:
Since:
  • 0.1.0

Determines if a value is valid ES6 Symbol.

Example
is_symbol(Symbol('x')); // => true
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is an symbol, otherwise false.

Type
Boolean

(static) is_undefined(value) → {Boolean}

Source:
Since:
  • 0.1.0

A function that determines whether the passed value is undefined.

Example
is_undefined(); // => true
is_undefined(void 0); // => true
is_undefined(null); // => false
Parameters:
Name Type Description
value *

The value to check.

Returns:

true if the value is undefined, otherwise false.

Type
Boolean