An array-like iterable
object to convert to a KoconutArray.
Accumulates value starting with initial
value and applying operation
from left to right to current accumulator value and each element.
A value to use as the first argument to the first call of the operation
.
A callback function that accepts one argument. The operation
accumulates callback's return value. It's accumulated value
previously returned in the last invocation of the callback or initial
value. The method calls the operation
one time for each element in object.
An object to which the this
keyword can refer in the operation
. If thisArg
is omitted, null
is used as the this
value.
Accumulates value starting with initial
value and applying operation
from left to right to current accumulator value and each element.
A value to use as the first argument to the first call of the operation
.
A callback function that accepts one argument. The operation
accumulates callback's return value. It's accumulated value
previously returned in the last invocation of the callback or initial
value. The method calls the operation
one time for each element and index in object.
An object to which the this
keyword can refer in the operation
. If thisArg
is omitted, null
is used as the this
value.
Returns the number of the elements matching the given predicate
. If the predicate
is ommitted it'll returns the whole number of elements.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element yielding the largest value of the given function or throws KoconutNoSuchElementException if there are no elements.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element yielding the largest value of the given function or null if there are no elements.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
Returns the largest value among all values produced by selector
function applied to each element in the collection or
throws KoconutNoSuchElementException if there are no elements.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
Returns the largest value among all values produced by selector
function applied to each element in the collection or
null if there are no elements.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
Returns the largest value according to the provided comparator
among all values
produced by selector
function applied to each element in the collection all throws KoconutNoSuchElementException
if elements are empty.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value.
Returns the largest value according to the provided comparator
among all values
produced by selector
function applied to each element in the collection or null
if elements are empty.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element having the largest value according to the provided comparator
or throws KoconutNoSuchElementException
if elements are empty.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element having the largest value according to the provided comparator
or null
if elements are empty.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element yielding the samllest value of the given function or throws KoconutNoSuchElementException if there are no elements.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element yielding the samllest value of the given function or null
if there are no elements.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
Returns the smallest value among all values produced by selector
function applied to each element in the collection or
throws KoconutNoSuchElementException if there are no elements.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
Returns the smallest value among all values produced by selector
function applied to each element in the collection or
null
if there are no elements.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
Returns the smallest value according to the provided comparator
among all values
produced by selector
function applied to each element in the collection all throws KoconutNoSuchElementException
if elements are empty.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value.
Returns the smallest value according to the provided comparator
among all values
produced by selector
function applied to each element in the collection all null
if elements are empty.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element having the smallest value according to the provided comparator
or throws KoconutNoSuchElementException
if elements are empty.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element having the smallest value according to the provided comparator
or null
if elements are empty.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value.
Creates an KoconutArray instance that wraps original data.
Creates an KoconutSet instance that wraps original data.
Creates a new instance from iterable
object.
An array-like iterable
object to convert to a KoconutArray.
Creates a new instance with given count
as number of values. count
cannot be negative number.
Each value is provided from generator
with given ordered index.
Number of values.
A callback function that accepts an argument. The method calls the action
one time for each ordered index.
An object to which the this
keyword can refer in the generator
. If thisArg
is omitted, null
is used as the this
value.
Creates a new instance from variable number of arguments.
A set of elements to include in the new KoconutArray object.
Return true
if all elements match te given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns true
if the collection has at least one element matches the given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Checks if the specified element is contained in this collection.
The element to search for.
Checks if all the elements are contained in this collection.
The elements to search for.
Returns true
if the collection is empty (contains no elements), false
otherwise.
Returns true
if the collection is not empty.
Returns true
if this nullable collection is either null or empty.
predicate
callback function is optional. If it's omitted the method returns true
if the collection has no elements.
Otherwise, returns true
if no elements match the given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Performs the given action
on each element.
When you want to stop iteration in the meantime return
false
or KoconutLoopSignal.BREAK.
A callback function that accepts an argument. The method calls the action
one time for each element in object.
An object to which the this
keyword can refer in the action
. If thisArg
is omitted, null
is used as the this
value.
Performs the given action
on each element, providing sequential index with the element.
When you want to stop iteration in the meantime return
false
or KoconutLoopSignal.BREAK.
A callback function that accepts two arguments. The method calls the action
one time for each index and element in object.
An object to which the this
keyword can refer in the action
. If thisArg
is omitted, null
is used as the this
value.
Perfroms the given action
on each element and returns the original collection itself afterwards.
When you want to stop iteration in the meantime return
false
or KoconutLoopSignal.BREAK.
A callback function that accepts an argument. The method calls the action
one time for each element in object.
An object to which the this
keyword can refer in the action
. If thisArg
is omitted, null
is used as the this
value.
Performs the given action
on each element, providing sequential index with the element, and returns the collection itself afterwards.
When you want to stop iteration in the meantime return
false
or KoconutLoopSignal.BREAK.
A callback function that accepts two arguments. The method calls the action
one time for each index and element in object.
An object to which the this
keyword can refer in the action
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray containing only distinct elements from this collection. If the type of data is a simple number or string, the method will check equality by using '==' operator, but if it's not, you'd better make your custom class inherits KoconutEquatable.
Returns a KoconutArray containing only elements from the given collection having
distinct keys returned by the given selector
function.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value
Returns a KoconutArray containing all elements except first n
elements.
Elements number to except.
Returns a KoconutArray containg all elements except last n
elements.
Elements number to except.
Returns a KoconutArray containing all elements except last elements that satisfy the given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray containing all elements except first elements that satisfy the given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray containing only elements matching the given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray containing only elements matching the given predicate
with indexes.
A callback function that accepts two arguments. The method calls the predicate
one time for each index and element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Appends all elements matching the given predicate
with indexes to the given destination.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts two arguments. The method calls the predicate
one time for each index and element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray containing only elements not matching the given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray containing all elements that are not null
.
Appends all elements that are not null
to the given destination.
Appends all elements not matching the given predicate
to the given destination.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Appends all elements matching the given predicate
to the given destination.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray of all elements sorted according to natural sort order
of the value returned by specified selector
function. It could be either a number
, string
, or custom class
that inherits KoconutComparable.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value
Returns a KoconutArray of all elements sorted descending according to natural sort order
of the value returned by specified selector
function. It could be either a number
, string
, or custom class
that inherits KoconutComparable.
A callback function that accepts an argument. The method calls the selector
one time for each element in object.
An object to which the this
keyword can refer in the selector
. If thisArg
is omitted, null
is used as the this
value
Returns a KoconutArray of all elements sorted according to the
specified comparator
.
A callback function that accepts two arguements. The method calls the comparator
to compare two selected values.
In case the result is larger than 0, front is bigger than rear, and if it's less than 0 judge vice versa.
An object to which the this
keyword can refer in the comparator
. If thisArg
is omitted, null
is used as the this
value
Returns a KoconutArray containing first n
elements.
Elements number to take.
Returns a KoconutArray containg last n
elements.
Elements number to take.
Returns a KoconutArray containing last elements satisfying the given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray containing first elements satisfying the given predicate
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Processes all the chained objects and calls the specified function
block
with the result value as its argument and returns the original result.
A callback function that accepts an argument.
Processes all the chained objects and calls the specified function
block
with the result value as its argument and returns the final result
of the block
.
A callback function that accepts an argument. The method calls the block
and returns its result.
Processes all the chained objects ane returns Promise<void>
.
Processes all the chained object and returns original KoconutArray instance.
Processes all the chained objects and return the result.
Returns an element at the given index
or throws an KoconutIndexOutOfBoundsException if the index
is out of bounds of this collection.
The index of element to search for.
Returns an element at the given index
or the result of calling the defaultValue
function
if the index
is out of bounds of this collection.
The index of element to search for.
A callback function that accepts an argument. The method calls the defaultValue
function when index
is out of bounds.
An object to which the this
keyword can refer in the defaultValue
. If thisArg
is omitted, null
is used as the this
value.
Returns an element at the given index
or null
if the index is out of bounds of this collection.
The index of element to search for.
Returns the first element matching the given predicate
, or null
if no such element was found.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns the last element matching the given predicate
, or null
if no such element was found.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element matching the given predicate
. Or, if predicate
is omitted
method will just return the very first element of this collection. If source data is null or no element
matching given predicate
is found, it throws KoconutNoSuchElementException.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns the first element matching the given predicate
. Or, if predicate
is omitted
method will just return the very first element of this collection. If source data is null or no element
matching given predicate
is found, it returns null
.
A callback function that accepts an argument. The method calls the predicate
one time for each element in object.
An object to which the this
keyword can refer in the predicate
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutMap containing key-value paired Entry provided by transform
function applied to elements of the given collection.
A callback function that accepts an argument. The method calls the transform
one time for each element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutMap containing the elements from the given collection indexed by the key
returned from keySelector
function applied to each element.
valueTransform
callback function is optional. If it's not omitted the method returns
a KoconutMap instance containing the values provied by the funcion and indexed by keySelector
applied to elements of the given collection.
A callback function that accepts an argument. The method calls the keySelector
one time for each element in object.
A callback function that accepts an argument. The method calls the valueTransform
one time for each element in object it it's not omitted.
An object to which the this
keyword can refer in the keySelector
. If keySelectorThisArg
is omitted, null
is used as the this
value.
An object to which the this
keyword can refer in the valueTransform
. If valueTransformThisArg
is omitted, null
is used as the this
value.
Populates the given destination
map with entries, where key
is provided by
keySelector
function applied to each element.
valueTransform
callback function is optional. If it's omitted, each value of entry
is same as the original data. Otherwise, the value is provided by the valueTransform
function
applied to elements of the given collcetion.
Iterable destinaion. Map
to be exact.
A callback function that accepts an argument. The method calls the keySelector
one time for each element in object.
A callback function that accepts an argument. The method calls the valueTransform
one time for each element in object it it's not omitted.
An object to which the this
keyword can refer in the keySelector
. If keySelectorThisArg
is omitted, null
is used as the this
value.
An object to which the this
keyword can refer in the valueTransform
. If valueTransformThisArg
is omitted, null
is used as the this
value.
Populates the given destination
map with entries, provided by transform
function
applied to elements of the given collection
Iterable destinaion. Map
to be exact.
A callback function that accepts an argument. The method calls the transform
one time for each element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutMap where keys are original elements of the current object and values
are produced by the valueSelector
function applied to each element.
A callback function that accepts an argument. The method calls the valueSelector
one time for each element in object.
An object to which the this
keyword can refer in the valueSelector
. If thisArg
is omitted, null
is used as the this
value.
Populates the given destination
map with entries for each element of the
given collection, where key is the element itslef and value is provided by valueSelector
function
applied to that key.
Iterable destinaion. Map
to be exact.
A callback function that accepts an argument. The method calls the valueSelector
one time for each element in object.
An object to which the this
keyword can refer in the valueSelector
. If thisArg
is omitted, null
is used as the this
value.
Splits this collection into a KoconutArray of Arrays
each not exceeding the given size
.
The number of elements to take in each Array
, must be positive and can be greater than the number of elements in this collection.
A callback function that accepts an argument. The method calls the transform
with chunked data array
when it's not omitted.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Returns a single list of all elements yielded from results of transform
function being invoked on each element of original collection.
A callback function that accepts an argument. The method calls the transform
one time for each element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray of all elements yielded from results of transform
function being invoked on each element of original collection.
A callback function that accepts two arguments. The method calls the transform
one time for each index and element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Appends all elements yielded from results of transform
function being invoked
on each element and its index in the original collection, to the given destination
.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts two arguments. The method calls the transform
one time for each index and element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Appends all elements yielded from results of transform
function being invoked
on each element of original collection, to the given destination
.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts an argument. The method calls the transform
one time for each element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Returns a list containing the results of applying the given transform
function
to each element in the original collection.
A callback function that accepts an argument. The method calls the transform
one time for each element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Retruns a list of all elements yielded from results of transform
function beging invoked
on each element and its index in the original collection.
A callback function that accepts two arguments. The method calls the transform
one time for each index and element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Returns a KoconutArray containing only the results that are not null
nor undefined
of applying
the given transform
function to each element and its index in the original collection.
A callback function that accepts two arguments. The method calls the transform
one time for each index and element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Applies the given transform
function to each element and its index in the original
collection and appends the results that are not null
nor undefined
to the given destination
.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts two arguments. The method calls the transform
one time for each index and element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Applies the given transform
function to each element and its index in the original
collection and appends the results to the given destination
.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts two arguments. The method calls the transform
one time for each index and element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Returns a list containing results that are not null
nor undefined
of applying
the given transfrom
function to each element in the original collection. You can use this method as filter
then map
.
A callback function that accepts an argument. The method calls the transform
one time for each element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Applies the given transform
function to each element of the original collection
and appends only the results that are not null
nor undefined
.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts an argument. The method calls the transform
one time for each element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Applies the given transform
function to each element of the original collection
and appends the results to the given destination
.
Iterable destinaion. Array
or Set
to be exact.
A callback function that accepts an argument. The method calls the transform
one time for each element in object.
An object to which the this
keyword can refer in the transform
. If thisArg
is omitted, null
is used as the this
value.
Generated using TypeDoc
Creates a new instance from
iterable
object.1.0.10
const numbers = Array.of(1,2,3,4,5) const koconutNumbers = new KoconutArray(numbers) // ↑ This is a Koconut number array consists of 1 to 5. const emptyNumberArray = new KoconutArray<number>() // ↑ This is an empty Koconut number array.