type

Type tools.

License:
  • Apache-2.0
Source:

Members

(inner) maxInt

Maximum representable safe integer in JavaScript.

Source:

(inner) minInt

Minimum representable safe integer in JavaScript.

Source:

Methods

(inner) isArray(c) → {Boolean}

Determine if a given value is an Array.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isBoolean(c) → {Boolean}

Determine if a given value is a Boolean.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isDate(c) → {Date}

Determine if a given value is of Date type.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Date

(inner) isFunction(c) → {Boolean}

Determine if a given value is a Function.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isNumber(c) → {Boolean}

Determine if a given value is a proper Number (not NaN and not Infinity).

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isObject(c) → {Boolean}

Determine if a given value is an Object (not null, not undefined and not Array).

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isRegExp(c) → {RegExp}

Determine if a given value is of RegExp type.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
RegExp

(inner) isString(c) → {Boolean}

Determine if a given value is a String.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) lazyNullishCoalesce(left, right)

Lazy nullish coalescing (inspired by ?? operator, but with right operand eager evaluation prevented using function abstracion).

Returns its right operand when its left operand is null or undefined, and otherwise returns its left operand.

In assignments works almost as || operator, but also properly handle values coercing to false (0 or empty string).

Source:
Parameters:
Name Type Description
left
right
Returns:

left ?? right()

(inner) nullToUndefined(val) → {NullToUndefined.<T>}

If val is null then return undefined, else return val.

Source:
Parameters:
Name Type Description
val T
Returns:
Type:
NullToUndefined.<T>

val is ensured not to be null

(inner) toBool(x) → {Boolean}

Returns false for all falsy values (false, 0, "", null, undefined, and NaN), and true for all truthy values.

Source:
Parameters:
Name Type Description
x unknown
Returns:
Type:
Boolean

(inner) undefinedToNull(val) → {UndefinedToNull.<T>}

If val is undefined then return null, else return val.

Source:
Parameters:
Name Type Description
val T
Returns:
Type:
UndefinedToNull.<T>

val is ensured not to be undefined

Type constants.

License:
  • Apache-2.0
Source:

Members

(inner) maxInt

Maximum representable safe integer in JavaScript.

Source:

(inner) minInt

Minimum representable safe integer in JavaScript.

Source:

Methods

(inner) isArray(c) → {Boolean}

Determine if a given value is an Array.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isBoolean(c) → {Boolean}

Determine if a given value is a Boolean.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isDate(c) → {Date}

Determine if a given value is of Date type.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Date

(inner) isFunction(c) → {Boolean}

Determine if a given value is a Function.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isNumber(c) → {Boolean}

Determine if a given value is a proper Number (not NaN and not Infinity).

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isObject(c) → {Boolean}

Determine if a given value is an Object (not null, not undefined and not Array).

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isRegExp(c) → {RegExp}

Determine if a given value is of RegExp type.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
RegExp

(inner) isString(c) → {Boolean}

Determine if a given value is a String.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) lazyNullishCoalesce(left, right)

Lazy nullish coalescing (inspired by ?? operator, but with right operand eager evaluation prevented using function abstracion).

Returns its right operand when its left operand is null or undefined, and otherwise returns its left operand.

In assignments works almost as || operator, but also properly handle values coercing to false (0 or empty string).

Source:
Parameters:
Name Type Description
left
right
Returns:

left ?? right()

(inner) nullToUndefined(val) → {NullToUndefined.<T>}

If val is null then return undefined, else return val.

Source:
Parameters:
Name Type Description
val T
Returns:
Type:
NullToUndefined.<T>

val is ensured not to be null

(inner) toBool(x) → {Boolean}

Returns false for all falsy values (false, 0, "", null, undefined, and NaN), and true for all truthy values.

Source:
Parameters:
Name Type Description
x unknown
Returns:
Type:
Boolean

(inner) undefinedToNull(val) → {UndefinedToNull.<T>}

If val is undefined then return null, else return val.

Source:
Parameters:
Name Type Description
val T
Returns:
Type:
UndefinedToNull.<T>

val is ensured not to be undefined

Type tools.

License:
  • Apache-2.0
Source:

Members

(inner) maxInt

Maximum representable safe integer in JavaScript.

Source:

(inner) minInt

Minimum representable safe integer in JavaScript.

Source:

Methods

(inner) isArray(c) → {Boolean}

Determine if a given value is an Array.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isBoolean(c) → {Boolean}

Determine if a given value is a Boolean.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isDate(c) → {Date}

Determine if a given value is of Date type.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Date

(inner) isFunction(c) → {Boolean}

Determine if a given value is a Function.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isNumber(c) → {Boolean}

Determine if a given value is a proper Number (not NaN and not Infinity).

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isObject(c) → {Boolean}

Determine if a given value is an Object (not null, not undefined and not Array).

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) isRegExp(c) → {RegExp}

Determine if a given value is of RegExp type.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
RegExp

(inner) isString(c) → {Boolean}

Determine if a given value is a String.

Source:
Parameters:
Name Type Description
c unknown
Returns:
Type:
Boolean

(inner) lazyNullishCoalesce(left, right)

Lazy nullish coalescing (inspired by ?? operator, but with right operand eager evaluation prevented using function abstracion).

Returns its right operand when its left operand is null or undefined, and otherwise returns its left operand.

In assignments works almost as || operator, but also properly handle values coercing to false (0 or empty string).

Source:
Parameters:
Name Type Description
left
right
Returns:

left ?? right()

(inner) nullToUndefined(val) → {NullToUndefined.<T>}

If val is null then return undefined, else return val.

Source:
Parameters:
Name Type Description
val T
Returns:
Type:
NullToUndefined.<T>

val is ensured not to be null

(inner) toBool(x) → {Boolean}

Returns false for all falsy values (false, 0, "", null, undefined, and NaN), and true for all truthy values.

Source:
Parameters:
Name Type Description
x unknown
Returns:
Type:
Boolean

(inner) undefinedToNull(val) → {UndefinedToNull.<T>}

If val is undefined then return null, else return val.

Source:
Parameters:
Name Type Description
val T
Returns:
Type:
UndefinedToNull.<T>

val is ensured not to be undefined