List

List prototype extensions

Import

_ <- fat.type.List

Constructor

Name Signature Brief
List (val: Any) Wrap val into a list

Prototype members

Name Signature Brief
isEmpty (): Boolean Return true if length is zero
nonEmpty (): Boolean Return true if non-zero length
size (): Number Return list length
toText (): Text Return 'List' text literal
join (sep: Text): Text Join list with separator into text
flatten (): List Join list of lists into flat list
find (p: Method): Any Return first matching or null
contains (p: Method): Boolean Return has match for predicate
reverse (): List Return a reversed copy of the list
shuffle (): List Return a shuffled copy of the list
unique (): List Return unique items of the list
sort (): List Return a sorted copy of list

Example

_ <- fat.type.List
x = [ 'a', 'b', 'c' ]
x.size  # yields 3

See also

results matching ""

    No results matching ""