ReadableList
A list that cannot be changed.
Type Parameters
• M
Methods
countfunctionGets the number of items in the list.
Returns
The number of items.
number
toArrayfunctionConverts the list to an array.
Returns
An array containing all items. The items are the same as in the list.
readonly M[]
forEachfunctionExecutes a function for each item in the list.
Parameters
callbackForEachCallback<M>The function to run for each item.
Parameters
itemMThe current item in the list.
Returns
void
Returns
void
filterfunctionCreates a new array with items that match a specific type.
Parameters
filterTypeFilterPredicate<M, C>A function that checks if an item is of type C.
Parameters
itemMThe item to test.
Returns
true if the item is of type C, otherwise false.
item is C
Returns
An array of items that are of type C.
readonly C[]
Creates a new array with items that pass a test.
Parameters
filterFilterPredicate<M>A function that tests each item. Returns true to keep the item.
Parameters
itemMThe item to test.
Returns
true if the item should be included, otherwise false.
boolean
Returns
An array of items that passed the test.
readonly M[]