KADABRA API

LARA API

LARA Common Language API

(.js)
laraImport("lara.Collections");

(.lara)
import lara.Collections;

Collections

Collections

Collections

Utility methods related to Collections.


Static Members

partition

partition(arr, predicate)

https://stackoverflow.com/questions/29151435/javascript-place-elements-that-dont-match-filter-predicate-into-seperate-array
Returns an array with two arrays at index
0 and 1. The array at index 0 is all the items
in `arr` that passed the `predicate` truth test by
returning a truthy value. The array at index 1 is all the items
in `arr` that failed the `predicate` truth test by returning
a falsy value.

Parameters

arr: Array
predicate: (el:T, index:number, arr:Array) => any

Returns

[Array, Array]

printTable

printTable(headers, rowData, spacing)

Prints tabular data using 3 arrays,
first for headers ie. ["HeaderA", "HeaderB", ...],
second for the row data ie. [row1Obj, row2Obj, ...] where row1Obj.length == headers.length == spacing.length
third for spacing ie. [10, 100, ...]

Parameters

headers: Array
rowData: Array>
spacing: Array

sort

sort(values)

Parameters

values: Object[]|java.util.List - Values to sort in-place.

Returns

any - the sorted collection