Members
unsafeUID :string
Compute an 'unsafe' UID. While unsafe, it'll still do a decent job of being unique over the course of a session, but is based on Math.random() so limited and possibly redundant
Methods
Append(p_base, p_source) → {object}
Appends the value of an Object into another. First-level properties only, no overwriting.
Parameters:
| Name | Type | Description |
|---|---|---|
p_base |
object | The base object to append into |
p_source |
object | The reference object to fetch values from |
ArrayDiff(p_oldArray, p_newArray, p_out, p_in)
Creates a diff of two array, and 'old' one and a 'new' one, and outputs the result into two array (out & in) that must be provided.
Parameters:
| Name | Type | Description |
|---|---|---|
p_oldArray |
array | The old array to compare p_newArray against |
p_newArray |
array | The new array to compare p_oldArray against |
p_out |
array | Empty Array, will be filled with the items that are present in p_oldArray, but not in p_newArray |
p_in |
array | Empty Array, will be filled with the items that are not in p_oldArray, but present in p_newArray |
ArrayDiffCallbacks(p_oldArray, p_newArray, p_outCallback, p_inCallback)
Creates a diff of two array, and 'old' one and a 'new' one, and call functions for each item that has been either added or removed
Parameters:
| Name | Type | Description |
|---|---|---|
p_oldArray |
array | The old array to compare p_newArray against |
p_newArray |
array | The new array to compare p_oldArray against |
p_outCallback |
array | Will be called each time an item is present in p_oldArray, but not in p_newArray |
p_inCallback |
array | Will be called each time an item is not in p_oldArray, but present in p_newArray |
CamelSplit(p_string) → {string}
Split a 'CamelCase' string into a 'Camel Case' one
Parameters:
| Name | Type | Description |
|---|---|---|
p_string |
string | The string to split |
Clear(p_obj, p_returnNewEmpty) → {object}
Deletes all properties on an a given object. First-level properties only.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
p_obj |
object | The object to be emptied |
|
p_returnNewEmpty |
boolean |
false
|
Wether to return a new empty object or not |
Clone(p_base) → {object}
Clone an Object.
Parameters:
| Name | Type | Description |
|---|---|---|
p_base |
object | The base object to clone |
CloneArray(p_base) → {array}
Clone an Array. Recursive.
Parameters:
| Name | Type | Description |
|---|---|---|
p_base |
array | The base object to clone |
DateDiff(p_a, p_b)
A - B
Parameters:
| Name | Type | Description |
|---|---|---|
p_a |
* | |
p_b |
* |
DeepClear(p_obj, p_returnNewEmpty) → {object}
Deletes all properties on an a given object, and clears any value that is an object or an array itself. Recursive.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
p_obj |
object | The object to be emptied |
|
p_returnNewEmpty |
boolean |
false
|
Wether to return a new empty object or not |
DeepClearArray(p_arr)
Empty an array and clears any value that is an object or an array itself. Recursive.
Parameters:
| Name | Type | Description |
|---|---|---|
p_arr |
array | The object to be emptied |
Default(…args) → {*}
Returns the first non-void value
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
args |
* |
<repeatable> |
A list of values to test |
Ensure(p_obj, p_key, p_value)
Ensure a value is set on a object.
Parameters:
| Name | Type | Description |
|---|---|---|
p_obj |
object | The target object |
p_key |
string | The property's name |
p_value |
* | The default value to set the property to if it does not exists |
EnsureMultiple(p_obj, p_kvp)
Ensure a value is set on a object.
Parameters:
| Name | Type | Description |
|---|---|---|
p_obj |
object | The target object |
p_kvp |
object | The property's name |
FixSlash(p_string) → {string}
Replaces \ with /
Parameters:
| Name | Type | Description |
|---|---|---|
p_string |
string | The string to sanitize |
Get(p_obj, p_key, p_fallback) → {*}
Attempts to get the property value on a given object.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
p_obj |
object | The object to extract the property value from |
|
p_key |
string | The property's name |
|
p_fallback |
* |
null
|
The fallback value that will be returned if the property cannot be found, or if its value is 'void' |
InheritanceDistance(p_from, p_to) → {number}
Checks the 'inheritance distance' between two Classe or Instances thereof. p_to should be a 'distant child' of p_from, not the other way around.
Parameters:
| Name | Type | Description |
|---|---|---|
p_from |
Object | class | The base Class or Instance |
p_to |
Object | class | The target Class or Instance |
isArray(p_value) → {boolean}
Determine if a value is an Array
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isArrayBuffer(val) → {boolean}
Determine if a value is an ArrayBuffer
Parameters:
| Name | Type | Description |
|---|---|---|
val |
object | The value to test |
isBool(p_value) → {boolean}
Determine if a value is a Boolean
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isEmpty(p_value) → {boolean}
Determine if an object is empty
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isFunc(p_value) → {boolean}
Determine if a value is a Function
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isInstanceOf(p_source, p_target) → {boolean}
Determine if a (source) Class or Instance of a constructor is an instance of another (target) Class or Instance of a given Class. *
Parameters:
| Name | Type | Description |
|---|---|---|
p_source |
Object | function | The value to test |
p_target |
Object | function | The value to test against |
isNot(p_value, …args) → {boolean}
Checks whether a value is not equal to any of the provided ones
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
p_value |
* | The value to test |
|
args |
* |
<repeatable> |
The values to test against |
isNumber(p_value) → {boolean}
Determine if a value is a Number
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isObject(p_value) → {boolean}
Determine if a value is an Object
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isSame(p_source, p_other) → {boolean}
Checks whether two objects contains exactly the same values
Parameters:
| Name | Type | Description |
|---|---|---|
p_source |
object | The object to test |
p_other |
object | The object to test against |
isSameArray(p_source, p_other) → {boolean}
Checks whether two arrays contains exactly the same values at the same index
Parameters:
| Name | Type | Description |
|---|---|---|
p_source |
array | The array to test |
p_other |
array | The array to test against |
isString(p_value) → {boolean}
Determine if a value is a string
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isSymbol(p_value) → {boolean}
Determine if a value is an Object
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isUndefined(p_value) → {boolean}
Determine if a value is undefined
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
isVoid(p_value) → {boolean}
Determine if a value is either undefined or null
Parameters:
| Name | Type | Description |
|---|---|---|
p_value |
* | The value to test |
Join(p_array, p_joinStr, p_fromIndex, p_toIndex) → {string}
Join the content of an array from/to specific indices
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
p_array |
array | The array to join |
|
p_joinStr |
string | string to join with |
|
p_fromIndex |
number |
0
|
Start join index |
p_toIndex |
number | End join index |
Merge(p_base, p_source, p_skipExisting) → {object}
Merges the value of an Object into another. Recursive, overwrites (unless p_skipExisting === true)
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
p_base |
object | The base object to append into |
|
p_source |
object | The reference object to fetch values from |
|
p_skipExisting |
object |
false
|
Whether or not to overwrite on existing values |
MergeArray(p_base, p_source) → {array}
Add missing content from p_source into p_base (no duplicates)
Parameters:
| Name | Type | Description |
|---|---|---|
p_base |
array | |
p_source |
array |
Pad(p_num, p_size)
Pad a number with leading 0's
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
p_num |
number | ||
p_size |
number |
2
|
ParsePath(p_stringPath)
Breaks down a path into an object to the following format : { path:[catalog, catalog, ...], item:tailName, ext:extention, }
Parameters:
| Name | Type | Description |
|---|---|---|
p_stringPath |
string |
SetMissing(p_base, p_source, p_mergeArrays)
Copy values from p_source currently missing in p_base. Merge object properties
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
p_base |
* | ||
p_source |
* | ||
p_mergeArrays |
* |
false
|
if true, will unshift array values from source into base when the two values are arrays. |
SetOverwrite(p_base, p_source)
Set values from p_source to p_base, overriding existing values. Merge objects properties.
Parameters:
| Name | Type | Description |
|---|---|---|
p_base |
* | |
p_source |
* |
StartWithNumber(p_str) → {boolean}
Checks whether a string starts with a digit.
Parameters:
| Name | Type | Description |
|---|---|---|
p_str |
string | String to test |
ValidIdentifier(p_str) → {boolean}
Checks whether a string is a valid identifier.
Parameters:
| Name | Type | Description |
|---|---|---|
p_str |
string | String to test |