Constructor
- - -new ObjectArray(data) → {ObjectArray}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - License: -
- - - - - - - - -
- See: -
-
-
-
-
- - -
- -
-
-
-
-
The constructor is straight-forward. It can be provided with an existent object
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
data |
-
-
- - - -Object - - - - | - - - - - -Initial data to push into the ObjectArray |
-
Returns:
- - -ObjectArray object
--
-
- - Type - -
- - -ObjectArray - - - -
Members
- - - -(inner) data :Object
- - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Getter/setter for the root data of ObjectArray.
-Type:
--
-
- - -Object - - - -
Methods
- - - - - - -(inner) camelize(s) → {String}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.2.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns a camelized string (without uppercase leading character) - Replace dashes and spaces
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
s |
-
-
- - - -String - - - - | - - - - - -String to camelize |
-
Returns:
- - -Camelized string
--
-
- - Type - -
- - -String - - - -
(inner) childKey(key) → {String}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.3.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns the child key for a given key
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - - - - -Key |
-
Returns:
- - -Child key
--
-
- - Type - -
- - -String - - - -
(inner) clone(keepFlattenedopt) → {ObjectArray}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.3.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns a clone with same data of the current ObjectArray
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - -Default | - - -Description | -
---|---|---|---|---|
keepFlattened |
-
-
- - - -Boolean - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
-
- true
-
- |
-
-
- If true, the flattened dotted keys will remains flattened - otherwise, the full hierarchy will be restored |
-
Returns:
- - -Return cloned ObjectArray
--
-
- - Type - -
- - -ObjectArray - - - -
(inner) dashize(sopt) → {String}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.2.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns a dashed string - Replace Uppercases and spaces
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
s |
-
-
- - - -String - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- String to dashize |
-
Returns:
- - -Dashed string
--
-
- - Type - -
- - -String - - - -
(inner) dataset(keyopt) → {Object|undefined}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns dataset for the key. If no key is provided, - the whole data is returned
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - -Default | - - -Description | -
---|---|---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
-
- null
-
- |
-
-
- Key |
-
Returns:
- - -Data object or undefined if key doesn't exist
--
-
- - Type - -
- - -Object -| - -undefined - - - -
(inner) empty(Key) → {ObjectArray}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.2.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Empty the ObjectArray data. It can also be used as
- an alias for remove method
Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
Key |
-
-
- - - -dottedKey - - - - | - - - - - -Key to remove |
-
Returns:
- - -Return self for chaining
--
-
- - Type - -
- - -ObjectArray - - - -
(inner) flatten(dottedopt, pKeyopt) → {Boolean}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.3.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Flattens the object and replace data.
-Each object in the dataset is - recursively explored to extract data and bring it a top level.
-With default behaviour, if two or more properties have same name under - subkeys, the last explored one will replace the previous one.
-If the method is called with true as first parameter, the - resulting data keys will be dotted, preventing duplication. In that case, - you must access new keys with dataset method or by calling - the data key property with [] (e.g. doa.data['my.key']);
-Flatten can be run only on a subdataset by providing a key as second parameter.
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - -Default | - - -Description | -
---|---|---|---|---|
dotted |
-
-
- - - -Boolean - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
-
- false
-
- |
-
-
- - |
pKey |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
- - - | - - -Key to flatten. If not provided, the whole - dataset will flattened. |
-
Returns:
- - -Parent key
--
-
- - Type - -
- - -Boolean - - - -
(inner) forEach(cb, keyopt) → {void}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Runs a callback on each ObjectArray entry
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
cb |
-
-
- - - -forEachCallback - - - - | - - -- - - - - - | - - - - -Callback to be run |
-
key |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Dotted key to limit iterations through its subset - if empty, the global data object will be used |
-
Returns:
- - - - --
-
- - Type - -
- - -void - - - -
(inner) formUrlEncode(keyopt) → {String}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns a string suitable for a form-url-encoded query string
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Dotted key to limit iterations through its subset - if empty, the global data object will be used |
-
Returns:
- - -style string
--
-
- - Type - -
- - -String - - - -
(inner) has(key) → {Boolean}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Check if a given key exists in the ObjectArray
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - - - - -Key |
-
Returns:
- - -true if key exists, false otherwise
--
-
- - Type - -
- - -Boolean - - - -
(inner) import(Data, pKeyopt) → {ObjectArray}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.1.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Import an object as data into the ObjectArray
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
Data |
-
-
- - - -Object - - - - | - - -- - - - - - | - - - - -Object to import |
-
pKey |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Dotted parent key to import into |
-
Returns:
- - -Return self for chaining
--
-
- - Type - -
- - -ObjectArray - - - -
(inner) keys(pKey) → {Array|undefined}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns keys of a given dataset in the ObjectArray - If no parent key is provided, it will output the keys of - the root data object
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
pKey |
-
-
- - - -dottedKey - - - - | - - - - - -Parent key |
-
Returns:
- - -Array of keys for the dataset - or undefined if key doesn't exist
--
-
- - Type - -
- - -Array -| - -undefined - - - -
(inner) length(pKey) → {Number|undefined}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns length of a given dataset in the ObjectArray - If no parent key is provided, it will output the length of - the root data object
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
pKey |
-
-
- - - -dottedKey - - - - | - - - - - -Parent key |
-
Returns:
- - -Length of the dataset or undefined if key doesn't exist
--
-
- - Type - -
- - -Number -| - -undefined - - - -
(inner) parentKey(key) → {String}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.1
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns the parent key for a given key
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - - - - -Key |
-
Returns:
- - -Parent key
--
-
- - Type - -
- - -String - - - -
(inner) pull(keyopt) → {Object|undefined}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.4.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Alias for dataset method
. Returns dataset for the key.
- If no key is provided, the whole data is returned
Parameters:
- - -Name | - - -Type | - - -Attributes | - - - -Default | - - -Description | -
---|---|---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
-
- null
-
- |
-
-
- Key |
-
Returns:
- - -Data object or undefined if key doesn't exist
--
-
- - Type - -
- - -Object -| - -undefined - - - -
(inner) push(key, val, pKeyopt) → {ObjectArray}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.1.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Push a new key/value pair
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - -- - - - - - | - - - - -Key of the added item |
-
val |
-
-
- - - -Number -| - -String -| - -Array -| - -Object - - - - | - - -- - - - - - | - - - - -Value of the added item |
-
pKey |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Parent key to push into |
-
Returns:
- - -Return self for chaining
--
-
- - Type - -
- - -ObjectArray - - - -
(inner) reduce(reducer, startopt, keyopt) → {Mixed}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Reduce the ObjectArray data given a callback
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
reducer |
-
-
- - - -Callback - - - - | - - -- - - - - - | - - - - -Callback to apply to each key/value (from left) |
-
start |
-
-
- - - -Mixed - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Initial value for iteration |
-
key |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Dotted key to limit iterations through its subset - if empty, the global data object will be used |
-
Returns:
- - -Callback returns value
--
-
- - Type - -
- - -Mixed - - - -
(inner) remove(key) → {ObjectArray}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Remove key/value pair
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - - - - -Key of the added item |
-
Returns:
- - -Return self for chaining
--
-
- - Type - -
- - -ObjectArray - - - -
(inner) stringToStyles(str, pkeyopt) → {ObjectArray}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.3
-
-
-
- - Since: -
- 1.2.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Imports a string from a style attribute. - ObjectArray will camelize key from spaces and/or dashes
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
str |
-
-
- - - -String - - - - | - - -- - - - - - | - - - - -String to import |
-
pkey |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Dotted key to import styles into. - If omitted, the object will be available at top-level |
-
Returns:
- - -Returns self for chaining
--
-
- - Type - -
- - -ObjectArray - - - -
(inner) stylesToString(keyopt) → {String}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.1.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns a string suitable for a style attribute. - ObjectArray will convert camel-cased key to dashed key.
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Dotted key to limit iterations through its subset - if empty, the global data object will be used |
-
Returns:
- - -style string
--
-
- - Type - -
- - -String - - - -
(inner) urlEncode(keyopt) → {String}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns a string suitable for a URI query string
-Parameters:
- - -Name | - - -Type | - - -Attributes | - - - - -Description | -
---|---|---|---|
key |
-
-
- - - -dottedKey - - - - | - - -
-
- <optional> - - - - - - |
-
-
-
-
- Dotted key to limit iterations through its subset - if empty, the global data object will be used |
-
Returns:
- - -style string
--
-
- - Type - -
- - -String - - - -
(inner) values(pKey) → {Array|undefined}
- - - - - - --
-
-
-
- Source: -
- - - - -
- Version: -
- 1.0.0
-
-
-
- - Since: -
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns values of a given dataset in the ObjectArray - If no parent key is provided, it will output the keys of - the root data object
-Parameters:
- - -Name | - - -Type | - - - - - -Description | -
---|---|---|
pKey |
-
-
- - - -dottedKey - - - - | - - - - - -Parent key |
-
Returns:
- - -Array of values for the dataset - or undefined if key doesn't exist
--
-
- - Type - -
- - -Array -| - -undefined - - - -