- Source:
Members
(inner, constant) BREAK :symbol
- Source:
Break from functional loops: forEach, filter, ...
Type:
- symbol
(inner, constant) ANY :symbol
- Source:
Match Any: Used as value in predicate object
Type:
- symbol
Methods
(inner) item(s, i) → {any|null|undefined}
- Source:
Get item by index from multiple source types
Parameters:
Name | Type | Description |
---|---|---|
s |
Array | Object | String | NodeList | HTMLCollection | source |
i |
Number | String | item index |
Returns:
- Type
- any | null | undefined
(inner) contains(src, value, keyopt) → {boolean}
- Source:
Source contains value or key:value
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
Array | Object | String | ||
value |
any | ||
key |
String | undefined |
<optional> |
Returns:
- Type
- boolean
(inner) add(src, …v)
- Source:
Add item(s) to source
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
Array | Object | source | |
v |
any |
<repeatable> |
values |
(inner) remove(src, …it) → {boolean}
- Source:
Remove item(s) from source
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
Array | String | ||
it |
any |
<repeatable> |
Returns:
- Type
- boolean
(inner) toggle(src, …c)
- Source:
Toggles items in source
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
Array | ||
c |
any |
<repeatable> |
(inner) emptyOf(src, def) → {any}
- Source:
Create empty instance of given source
Parameters:
Name | Type | Description |
---|---|---|
src |
any | source object |
def |
any | default value for primitives |
Returns:
empty instance of src
- Type
- any
(inner) concat(target, source) → {Array|String|Object}
- Source:
Type-agnostic concat
Parameters:
Name | Type | Description |
---|---|---|
target |
Array | String | Object | |
source |
Array | String | Object |
Returns:
- Type
- Array | String | Object
(inner) objectValues(obj) → {Array|undefined}
- Source:
Polyfill-like for Object.values (uses native method if available)
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
Returns:
- array of values
- Type
- Array | undefined
(inner) forN(func, init, finish, stepopt)
- Source:
Index for loop from "init" to "finish"(included) by "step"
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
func |
function | |||
init |
Number |
0
|
||
finish |
Number |
0
|
||
step |
Number |
<optional> |
(inner) forEachRange(src, func, startopt, endopt, nullable) → {*|number}
- Source:
forEach(left) with limited range
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
src |
Array | Object | NodeList | HTMLCollection | |||
func |
function | |||
start |
Number |
<optional> |
0
|
|
end |
Number |
<optional> <nullable> |
Returns:
- Type
- * | number
(inner) forEach(src, func) → {number|*}
- Source:
Type-agnostic forEach loop
Parameters:
Name | Type | Description |
---|---|---|
src |
||
func |
Returns:
- Type
- number | *
(inner) forEachRight(src, func, range) → {number|*}
- Source:
Type-agnostic forEachRight loop
Parameters:
Name | Type | Description |
---|---|---|
src |
||
func |
||
range |
Returns:
- Type
- number | *
(inner) firstIndex(src, pred) → {number}
- Source:
- See:
-
- forEach
Extended version of native indexOf method, using
forEach
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | Object | Array | predicate function/{key:value}/[keys] |
Returns:
- Type
- number
(inner) first(src, pred) → {*}
- Source:
- See:
-
- firstIndex
Extended version of native first method, using
firstIndex
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | Object | Array | predicate function/{key:value}/[keys] |
Returns:
- Type
- *
(inner) startsWith(src, pred) → {boolean|*}
- Source:
Returns true if first item matches predicate
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | Object | Array | predicate function/{key:value}/[keys] pred |
Returns:
- Type
- boolean | *
(inner) lastIndex(src, pred) → {number}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | Array | Object |
Returns:
- Type
- number
(inner) last(src, pred) → {*}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | Array | Object |
Returns:
- Type
- *
(inner) endsWith(src, pred) → {boolean|*}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | Array | Object |
Returns:
- Type
- boolean | *
(inner) reverse(src) → {Array|Object|String|NodeList|HTMLCollection}
- Source:
Reverse array-like src
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection |
Returns:
- reversed src
- Type
- Array | Object | String | NodeList | HTMLCollection
(inner) any(src, pred) → {boolean}
- Source:
A more versatile alternative to native "some" method
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | Array | Object |
Returns:
- Type
- boolean
(inner) all(src, pred) → {boolean}
- Source:
A more versatile alternative to native "every" method
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | Array | Object |
Returns:
- Type
- boolean
(inner) filter(src, pred, rightopt) → {Array|Object|String}
- Source:
A more versatile alternative to native "filter" method
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | source | ||
pred |
function | Array | Object | predicate function/{key:value}/[keys] | ||
right |
boolean |
<optional> |
false
|
reverse loop |
Returns:
- Type
- Array | Object | String
(inner) omit(src, pred, rightopt) → {Array|Object|String}
- Source:
Opposite of filter, returns items not matching predicate
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | source | ||
pred |
function | Array | Object | predicate function/{key:value}/[keys] | ||
right |
boolean |
<optional> |
false
|
reverse loop |
Returns:
- Type
- Array | Object | String
(inner) filterRight(src, pred) → {Array|Object|String}
- Source:
filter
in reverse order (right)
Parameters:
Name | Type | Description |
---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | source |
pred |
function | Array | Object | predicate function/{key:value}/[keys] |
Returns:
- Type
- Array | Object | String
(inner) maxIndex(list, pred) → {number}
- Source:
Find max index
Parameters:
Name | Type | Description |
---|---|---|
list |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | String | predicate function/key |
Returns:
- Type
- number
(inner) max(list, pred) → {number}
- Source:
Find max
Parameters:
Name | Type | Description |
---|---|---|
list |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | String | predicate function/key |
Returns:
- Type
- number
(inner) minIndex(list, pred) → {number}
- Source:
Find min index
Parameters:
Name | Type | Description |
---|---|---|
list |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | String | predicate function/key |
Returns:
- Type
- number
(inner) min(list, pred) → {number}
- Source:
Find min
Parameters:
Name | Type | Description |
---|---|---|
list |
Array | Object | String | NodeList | HTMLCollection | |
pred |
function | String | predicate function/key |
Returns:
- Type
- number
(inner) map(src, transform, rightopt) → {Array|Object|String}
- Source:
A more versatile alternative to native "map" method
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | source | ||
transform |
function | Array | Object | transformer function | ||
right |
boolean |
<optional> |
false
|
reverse loop |
Returns:
- Type
- Array | Object | String
(inner) flatMap(src, transformopt) → {Array|Object|String}
- Source:
A more versatile alternative to native "flatMap" method, flattens first level items
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
Array | Object | String | NodeList | HTMLCollection | source | |
transform |
function | Array | Object |
<optional> |
transformer function |
Returns:
- Type
- Array | Object | String
(inner) reduce(src, func, accopt) → {any}
- Source:
A more versatile alternative to native "reduce" method
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
any | source | |
func |
function | Array | Object | reducer function | |
acc |
any |
<optional> |
accumulator |
Returns:
- Type
- any
(inner) reduceRight(src, func, accopt) → {any}
- Source:
- See:
-
- reduce
reduce
in reverse
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
any | source | |
func |
function | Array | Object | reducer function | |
acc |
any |
<optional> |
accumulator |
Returns:
- Type
- any
(inner) keyValuePairs(object) → {Array.<Object>}
- Source:
Extract single key-value pairs from object
Parameters:
Name | Type | Description |
---|---|---|
object |
Returns:
- Type
- Array.<Object>
(inner) entries(object) → {Array.<Array>}
- Source:
Like Object.entries extracts key-value pairs as [[key1,value1],[key2,value2],...]
Parameters:
Name | Type | Description |
---|---|---|
object |
Object |
Returns:
- Type
- Array.<Array>
(inner) translateObject(source, dict) → {Array|Object|String}
- Source:
Translate(rename) object fields using dict parameter, omitting undefined keys
Parameters:
Name | Type | Description |
---|---|---|
source |
Object | |
dict |
Object | Array |
Returns:
- Type
- Array | Object | String
(inner) deepMerge(target, source, excludeKeys, maxDepth, allowUnsafeProps) → {Object|Array}
- Source:
Recursive deep merge {@param target} with {@param source}
Parameters:
Name | Type | Description |
---|---|---|
target |
Object | Array | |
source |
Object | Array | |
excludeKeys |
Array | keys to be skipped while merging |
maxDepth |
maximum recursive depth | |
allowUnsafeProps |
allow unsafe properties like __proto__ |
Returns:
- Type
- Object | Array
(inner) deepClone(source, excludeKeys, maxDepthopt, allowUnsafePropsopt) → {Object|Array}
- Source:
- See:
-
- deepMerge
Recursive deep clone {@param source}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
source |
Object | Array | ||
excludeKeys |
Array | keys to be skipped while merging | |
maxDepth |
Number |
<optional> |
maximum recursive depth |
allowUnsafeProps |
boolean |
<optional> |
allow unsafe properties like __proto__ |
Returns:
- Type
- Object | Array
(inner) join(key, …lists) → {Object}
- Source:
Join arrays of objects based on a generated or static key
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
function | String | ||
lists |
Array.<Object> |
<repeatable> |
Returns:
- Type
- Object
(inner) groupBy(key, …lists) → {Object}
- Source:
Group arrays based on generated or static key(s)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
function | String | ||
lists |
Array.<Object> |
<repeatable> |
Returns:
- Type
- Object