Module: utils/type-utils

Utility submodule containing type checker and helper.

Since:
  • 1.2.0
Author:
  • Ryuu Mitsuki <https://github.com/mitsuki31>
License:
  • MIT
Source:

Methods

(package, inner) dropNullAndUndefined(obj) → {Object}

Drops null and undefined values from the input object.

Parameters:
Name Type Description
obj Object

The input object to filter null and undefined values from.

Since:
  • 1.0.0
Source:
Returns:

The filtered object without null and undefined values.

Type
Object

(package, inner) getType(x) → {string}

Returns the type of the provided value as a string.

For null values, it returns 'null', and for objects, it returns a more detailed type such as '[object Object]'.

Parameters:
Name Type Description
x any

The value whose type is to be determined.

Since:
  • 1.1.0
Source:
Returns:

A string representing the type of the value.

Type
string

(package, inner) isNullOrUndefined(x) → {boolean}

Checks if a given value is null or undefined.

Parameters:
Name Type Description
x any

The value to check.

Since:
  • 1.0.0
Source:
Returns:

true if the value is null or undefined, otherwise false.

Type
boolean

(package, inner) isObject(x) → {boolean}

Determines whether the provided value is a non-null object.

This function returns true for any value that is of the object type and is not null, but it does not guarantee that the object is a plain object ({}).

Parameters:
Name Type Description
x any

The value to be checked.

Since:
  • 1.0.0
Source:
See:
  • isPlainObject
Returns:

true if the value is a non-null object, otherwise false.

Type
boolean

(package, inner) isPlainObject(x) → {boolean}

Determines whether the provided value is a plain object ({}).

This function returns true only if the value is a non-null object with a prototype of Object.

Parameters:
Name Type Description
x any

The value to be checked.

Since:
  • 1.1.0
Source:
See:
  • isObject
Returns:

true if the value is a plain object, otherwise false.

Type
boolean