Methods
(static) concatValues(object) → {array}
- Source:
- Since:
- 0.4.0
Concatenate the values of the provided object.
Example
> concatValues({a: [1, 2, 3], b: [4, 5, 6]})
[1, 2, 3, 4, 5, 6]
Parameters:
Name | Type | Description |
---|---|---|
object |
object |
Returns:
- Type
- array
(static) getTruthyValuesKeys(object) → {array}
- Source:
- Since:
- 0.1.0
Return the keys of the provided object with a truthy value
Example
> getTruthyValuesKeys({a: true, b: true, c: false})
['a', 'b']
> getTruthyValuesKeys({a: 1, b: 0, c: false})
['a']
> getTruthyValuesKeys({a: [1, 2], b: {a: 1}, c: false})
['a', 'b']
Parameters:
Name | Type | Description |
---|---|---|
object |
object | The input object |
Returns:
- The keys correspondent to truthy values
- Type
- array
(static) makeKeyedValuesPermutations(object) → {array}
- Source:
- Since:
- 0.6.0
Return an array of the permutations of the provided object values items, by key. Note that this function assumes the provided object values are arrays.
Example
> makeKeyedValuesPermutations({a: [0, 1], b: [2, 3], c: [4, 5]})
[
{a: 0, b: 2, c: 4}, {a: 1, b: 2, c: 4},
{a: 0, b: 3, c: 4}, {a: 1, b: 3, c: 4},
{a: 0, b: 2, c: 5}, {a: 1, b: 2, c: 5},
{a: 0, b: 3, c: 5}, {a: 1, b: 3, c: 5}
]
Parameters:
Name | Type | Description |
---|---|---|
object |
object | {string: any[]} |
Returns:
- object[]
- Type
- array
(static) objectToKeyValueArray(object) → {array}
- Source:
- Since:
- 0.1.0
Return an array of {key, value} objects from an object
Example
> obj = {k1: 'v1', k2: 'v2'}
> objectToKeyValueArray(obj)
[{key: 'k1', value: 'v1'}, {key: 'k2', value: 'v2'}]
Parameters:
Name | Type | Description |
---|---|---|
object |
object |
Returns:
- Type
- array
(static) objectToKeyValuesArray(object) → {array}
- Source:
- Since:
- 0.21.0
Return an array of {key, values} objects from an object
Example
> obj = {k1: ['a', 'b'], k2: ['c', 'd']}
> objectToKeyValuesArray(obj)
[{key: 'k1', values: ['a', 'b']}, {key: 'k2', values: ['c', 'd']}]
Parameters:
Name | Type | Description |
---|---|---|
object |
object |
Returns:
- Type
- array