Returns the first argument which is defined.
Functions.coalesce(3, 4); // 3
Functions.coalesce(undefined, 4); // 4
Functions.coalesce(null, 4); // null
Functions.coalesce(void 0, void 0, 5); // 5
The first argument to look at.
The second argument to look at.
The first defined argument.
Copies values from from
object and sets them to the target
object.
The object to set values to.
The object to copy value references from.
The reference to target
.
Determines whether the given input is an array.
The variable to test.
true
if the variable is an array, otherwise false
.
Determines whether the two arrays given are stricly equivalent. If the
arrays are not the same length or contain the same values in the same order
then false
is returned.
The first array to test.
The second array to test.
true
if they have the same exact values, otherwise false
.
Determines whether the given input is defined.
The variable to test.
true
if the variable is defined, otherwise false
.
Determines whether the given input appears to be a valid FrequencyValueEquals.
Functions.isFrequencyValueEquals({}); // false
Functions.isFrequencyValueEquals([]); // false
Functions.isFrequencyValueEquals([1]); // false
Functions.isFrequencyValueEquals(null); // false
Functions.isFrequencyValueEquals(0); // false
The variable to test.
true
if the variable appears to be a FrequencyValueOneOf,
otherwise false.
Determines whether the given input appears to be a valid FrequencyValueEvery.
Functions.isFrequencyValueEvery({}); // false
Functions.isFrequencyValueEvery([]); // false
Functions.isFrequencyValueEvery([1]); // false
Functions.isFrequencyValueEvery(null); // false
Functions.isFrequencyValueEvery({every:2}); // true
Functions.isFrequencyValueEvery({offset:1}); // false
Functions.isFrequencyValueEvery({every:2, offset:1}); // true
The variable to test.
true
if the variable appears to be a FrequencyValueEvery,
otherwise false.
Determines whether the given input appears to be a valid FrequencyValueOneOf.
Functions.isFrequencyValueOneOf({}); // false
Functions.isFrequencyValueOneOf([]); // false
Functions.isFrequencyValueOneOf([1]); // true
Functions.isFrequencyValueOneOf(null); // false
The variable to test.
true
if the variable appears to be a FrequencyValueOneOf,
otherwise false.
Determines whether the given input is a finite number (a number which is not infinite or not the result of a divide-by-zero operation).
The variable to test.
true
if the variable is a finite number, otherwise false
.
Determines whether the given input is an object and NOT an array.
The variable to test.
true
if the variable is a plain object, otherwise false
.
Determines whether the given input is a string.
The variable to test.
true
if the variable is a string, otherwise false
.
Determines whether the given input is defined and not null.
The variable to test.
true
if the variable is defined and not null, otherwise false
.
Pads the string x
up to length
characters with the given padding
optionally placing the padding
before
x
.
Functions.pad('hey', 5, '_', false); // 'hey__'
Functions.pad('hey', 5, '_', true); // '__hey'
Functions.pad('heyman', 5, '_', true); // 'heyman'
The string to pad.
The length to pad to.
The string to pad with.
If the padding should go before the string to pad.
The padded string if any padding needed be added.
Pads the number x
up to length
digits where the padding is 0
and it
goes before x
. This function will only return the first length
characters of the padding string representation of the number but can return
an alternative number of first
characters.
Functions.padNumber(29, 3); // '029'
Functions.padNumber(29, 3, 2); // '02'
Functions.padNumber(9573, 3); // '957'
The number to pad with zeros in the beginning.
The number of digits the number should be padded to.
The number of digits to return from the start of the string.
A padded number.
Generated using TypeDoc
The class which contains commonly used functions by the library. These functions and variables exist in a class so they may be overridden if desired.