Skip to content

Other functions

Arthur Guiot edited this page May 18, 2018 · 2 revisions

Apply

You can easily apply a function to a number or an array:

t.apply(2, x => 2*x) // 4
t.apply([2, 4], x => x / 2) // [1, 2]

Min, Max and Sort

t.min(2, 1, 3, 4) // 1
t.max(2, 1, 3, 4) // 4
t.sort(2, 1, 3, 4) // [1, 2, 3, 4]
t.product(5, 6, 12, 8) // 2880 => BigNumber
t.sum(5, 6, 12, 8) // 31 => BigNumber

Clone this wiki locally