Lang functions
General purpose functions.
cast_array()
Casts value
as an array if it's not one.
cast_array(value)
Arguments
value
(Any)- The value to process.
Returns
- (Array)
- Returns the cast array.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
conforms_to()
Checks if object
conforms to source
by invoking the predicate properties of source
with the corresponding property values of object
.
conforms_to(object, source)
Arguments
object
(Object)- The object to process.
source
(Object)- The object of property predicates to conform to.
Returns
- (boolean)
- true if object conforms, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
eq()
Compare two values to determine if they are equivalent.
eq(value, other)
Arguments
Returns
- (Boolean)
- true if values are equivalent, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
gt()
Checks if value
is greater than other
.
gt(value, other)
Arguments
Returns
- (Boolean)
- true if value is greater than other, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
See also
gte()
Checks if value
is greater or equal to other
.
gte(value, other)
Arguments
Returns
- (Boolean)
- true if value is greater or equal to other, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
is_array()
Checks if value
is classified as an Array object.
is_array(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is an array, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
is_array_buffer()
Checks if value
is classified as an ArrayBuffer object.
is_array_buffer(value)
Arguments
value
(Any)- the value to check.
Returns
- (Boolean)
- true if value is an ArrayBuffer object, else false.
Examples
TBD
See also
is_array_like()
Checks if value
is array-like. A value is considered array-like if it's not a function and has a length()
that's an integer greater than or equal to 0
and less than or equal to 2^53 - 1
(MAX_SAFE_INTEGER
constant in JavaScript).
is_array_like(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is an array-like, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See also
is_boolean()
Checks if value
is classified as a boolean primitive or object.
is_boolean(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is boolean, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
is_buffer()
Checks if value
is classified as a buffer.
is_buffer(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is buffer, else false.
Examples
TBD
See also
is_date()
Checks if value
is classified as a Date object.
is_date(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is Date object, else false.
Examples
TBD
See also
is_empty()
Checks if value
is an empty object, collection, map, or set.
Objects are considered empty if they have no own enumerable string keyed properties. Array-like values such as arguments objects, arrays, buffers, or strings are considered empty if they have a length of 0. Similarly, maps and sets are considered empty if they have a size of 0
.
is_empty(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is empty, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See also
is_error()
Checks if value
is an Error.
is_error(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is an error, else false.
Examples
TBD
See also
is_finite()
Checks if value
is a finite primitive number.
is_finite(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is finite number, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
is_function()
Checks if value
is classified as a Function object.
is_function(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a function, else false.
Examples
TBD
is_integer()
Checks if value
is an Integer number.
is_integer(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is an integer number, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
See also
is_map()
Checks if value
is classified as a Map object.
is_map(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a Map, else false.
Examples
TBD
is_match()
Performs a partial deep comparison between object
and source
to determine if object
contains equivalent property values.
Partial comparisons will match empty array and empty object source values against any array or object value, respectively.
is_match(object, source)
Arguments
Returns
- (Boolean)
- true if property of an object matches, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
is_nan()
Checks if value
is NaN
(representing Not-A-Number).
There are following different types of operations that return NaN
:
- Number cannot be parsed, for example
parse_int('not a number')
. - Math operation where the result is not a real number, for example
sqrt(-1)
. - Operand of an argument is
NaN
, for example:pow(7, sqrt(-1))
. - Indeterminate form, for example:
multiply(0, positive_infinity())
.
is_nan(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if the given value is a
NaN
, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
is_null()
Checks if value
is null.
is_null(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is null, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
is_number()
Checks if value
is a Number.
is_number(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is Number, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
is_object()
Checks if value
is an Object (e.g. Arrays, Objects, Functions, etc. See ECMAScript Object type spec).
is_object(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is Object, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See also
is_object_like()
Checks if value
is object-like. A value is object-like if it's not null and has a type()
result of "object"
.
is_object_like(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is an object-like, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
is_plain_object()
Checks if value
is a plain object. Plain object is an unordered set of name/value pairs that begins with {
and ends with }
.
is_plain_object(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a plain object, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
is_regexp()
Checks if value
is classified as a RegExp object.
is_regexp(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a RegExp, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
is_safe_integer()
Checks if value
is a safe integer. An integer is safe if it's an double precision number (IEEE-754 standard) which isn't the result of a rounded unsafe integer.
is_safe_integer(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a safe integer, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
is_set()
Checks if value
is classified as a Set object.
is_set(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a Set, else false.
Examples
TBD
is_string()
Checks if value
is classified as a String primitive or object.
is_string(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a String, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
is_symbol()
Checks if value
is classified as a Symbol primitive or object.
is_symbol(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a Symbol, else false.
Examples
TBD
is_typed_array()
Checks if value
is classified as a typed array.
is_typed_array(value)
Arguments
value
(Any)- The value to check.
Returns
- (Boolean)
- true if value is a typed array, else false.
Examples
TBD
lt()
Checks if value
is less than other
.
lt(value, other)
Arguments
Returns
- (Boolean)
- true if value is less than other, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
lte()
Checks if value
is less or equal to other
.
lte(value, other)
Arguments
Returns
- (Boolean)
- true if value is less or equal to other, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
to_array()
Converts value
to an array.
to_array(value)
Arguments
value
(Any)- The value to convert.
Returns
- (Array)
- Converted array.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
See also
to_finite()
Converts value
to a finite number.
to_finite(value)
Arguments
value
(Any)- The value to convert.
Returns
- (Number)
- Converted number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See also
to_integer()
Converts value
to an integer.
to_integer(value)
Arguments
value
(Any)- The value to convert.
Returns
- (Number)
- Converted number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See also
to_number()
Converts value
to a number.
to_number(value)
Arguments
value
(Any)- The value to convert.
Returns
- (Number)
- Converted number.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See also
to_plain_object()
Converts value
to a plain object flattening inherited enumerable string keyed properties of value
to own properties of the plain object.
to_plain_object(value)
Arguments
value
(Any)- The value to convert.
Returns
- (Object)
- Converted plain object.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
See also
to_safe_integer()
Converts value
to a safe integer.
to_safe_integer(value)
Arguments
value
(Any)- The value to convert.
Returns
- (Number)
- Converted integer.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
to_string()
Converts value
to a String. An empty string is returned for null
and undefined
values. The sign of -0 is preserved.
to_string(value)
Arguments
value
(Any)- The value to convert.
Returns
- (String)
- Converted String.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
See also
regexp()
Constructs RegExp object that can be used for matching text with a pattern
.
regexp(pattern, [flags])
Arguments
pattern
(String | RegExp)- A string or a RegExp object that defines a search pattern.
flags
(String)(Optional) Flags changing the default search behavior of this regular expression. Overrides flags that are specified by the first argument. The following flags are supported:
- i: Case-insensitive search.
- m: Multiline mode.
- s: Enables “dotall” mode, that allows a dot
.
to match newline character\n
. - u: Enables full Unicode support.
Returns
- (RegExp)
- Created RegExp object.
Examples
TBD
See also
type()
Determines the type of the value
.
type(value)
Arguments
value
(Any)- The value to inspect.
Returns
- (String)
- The type of the inspected argument.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|