Functions

Browse all available utility functions by category

math

add

Adds two numbers.

Example:

add(6, 4); // 10
math

ceil

Computes number rounded up to precision.

Example:

ceil(4.006); // 5
math

divide

Divide two numbers.

Example:

divide(6, 4); // 1.5
math

floor

Computes number rounded down to precision.

Example:

floor(4.006); // 4
math

max

Computes the maximum value of array.

Example:

max([4, 2, 8, 6]); // 8
math

maxBy

This method is like max except that it accepts iteratee which is invoked for each element in array to generate the criterion by which the value is ranked.

Example:

const objects = [{ 'n': 1 }, { 'n': 2 }];
math

mean

Computes the mean of the values in array.

Example:

mean([4, 2, 8, 6]); // 5
math

meanBy

This method is like mean except that it accepts iteratee which is invoked for each element in array to generate the value to be averaged.

Example:

const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
math

min

Computes the minimum value of array.

Example:

min([4, 2, 8, 6]); // 2
math

minBy

This method is like min except that it accepts iteratee which is invoked for each element in array to generate the criterion by which the value is ranked.

Example:

const objects = [{ 'n': 1 }, { 'n': 2 }];
math

multiply

Multiply two numbers.

Example:

multiply(6, 4); // 24
math

round

Computes number rounded to precision.

Example:

round(4.006); // 4
math

subtract

Subtract two numbers.

Example:

subtract(6, 4); // 2
math

sum

Computes the sum of the values in array.

Example:

sum([4, 2, 8, 6]); // 20
math

sumBy

This method is like sum except that it accepts iteratee which is invoked for each element in array to generate the value to be summed.

Example:

const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];