Mathematical computations including basic arithmetic, aggregation functions, and range utilities for numerical operations.
Adds two numbers.
/**
* Adds two numbers.
* @param augend - The first number in an addition
* @param addend - The second number in an addition
* @returns Returns the sum
*/
function add(augend: number, addend: number): number;Computes number rounded up to precision.
/**
* Computes `number` rounded up to `precision`.
* @param number - The number to round up
* @param precision - The precision to round up to (defaults to 0)
* @returns Returns the rounded up number
*/
function ceil(number: number, precision?: number): number;Divide two numbers.
/**
* Divide two numbers.
* @param dividend - The first number in a division
* @param divisor - The second number in a division
* @returns Returns the quotient
*/
function divide(dividend: number, divisor: number): number;Computes number rounded down to precision.
/**
* Computes `number` rounded down to `precision`.
* @param number - The number to round down
* @param precision - The precision to round down to (defaults to 0)
* @returns Returns the rounded down number
*/
function floor(number: number, precision?: number): number;Computes the maximum value of array.
/**
* Computes the maximum value of `array`. If `array` is empty or falsey,
* `undefined` is returned.
* @param array - The array to iterate over
* @returns Returns the maximum value
*/
function max<T>(array: T[]): T | undefined;Like max except that it accepts iteratee which is invoked for each element to generate the criterion by which the value is ranked.
/**
* 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. The iteratee is invoked with one argument: (value).
* @param array - The array to iterate over
* @param iteratee - The iteratee invoked per element
* @returns Returns the maximum value
*/
function maxBy<T>(
array: T[],
iteratee?: string | ((value: T) => any)
): T | undefined;Computes the mean of the values in array.
/**
* Computes the mean of the values in `array`.
* @param array - The array to iterate over
* @returns Returns the mean
*/
function mean(array: number[]): number;Like mean except that it accepts iteratee which is invoked for each element to generate the value to be averaged.
/**
* 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.
* The iteratee is invoked with one argument: (value).
* @param array - The array to iterate over
* @param iteratee - The iteratee invoked per element
* @returns Returns the mean
*/
function meanBy<T>(
array: T[],
iteratee?: string | ((value: T) => number)
): number;Computes the minimum value of array.
/**
* Computes the minimum value of `array`. If `array` is empty or falsey,
* `undefined` is returned.
* @param array - The array to iterate over
* @returns Returns the minimum value
*/
function min<T>(array: T[]): T | undefined;Like min except that it accepts iteratee which is invoked for each element to generate the criterion by which the value is ranked.
/**
* 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. The iteratee is invoked with one argument: (value).
* @param array - The array to iterate over
* @param iteratee - The iteratee invoked per element
* @returns Returns the minimum value
*/
function minBy<T>(
array: T[],
iteratee?: string | ((value: T) => any)
): T | undefined;Multiply two numbers.
/**
* Multiply two numbers.
* @param multiplier - The first number in a multiplication
* @param multiplicand - The second number in a multiplication
* @returns Returns the product
*/
function multiply(multiplier: number, multiplicand: number): number;Computes number rounded to precision.
/**
* Computes `number` rounded to `precision`.
* @param number - The number to round
* @param precision - The precision to round to (defaults to 0)
* @returns Returns the rounded number
*/
function round(number: number, precision?: number): number;Subtract two numbers.
/**
* Subtract two numbers.
* @param minuend - The first number in a subtraction
* @param subtrahend - The second number in a subtraction
* @returns Returns the difference
*/
function subtract(minuend: number, subtrahend: number): number;Computes the sum of the values in array.
/**
* Computes the sum of the values in `array`.
* @param array - The array to iterate over
* @returns Returns the sum
*/
function sum(array: number[]): number;Like sum except that it accepts iteratee which is invoked for each element to generate the value to be summed.
/**
* 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.
* The iteratee is invoked with one argument: (value).
* @param array - The array to iterate over
* @param iteratee - The iteratee invoked per element
* @returns Returns the sum
*/
function sumBy<T>(
array: T[],
iteratee?: string | ((value: T) => number)
): number;Checks if n is between start and up to, but not including, end.
/**
* Checks if `n` is between `start` and up to, but not including, `end`. If
* `end` is not specified, it's set to `start` with `start` then set to `0`.
* If `start` is greater than `end` the params are swapped to support
* negative ranges.
* @param number - The number to check
* @param start - The start of the range
* @param end - The end of the range
* @returns Returns `true` if `number` is in the range, else `false`
*/
function inRange(number: number, start: number, end?: number): boolean;Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
* @param start - The start of the range
* @param end - The end of the range
* @param step - The value to increment or decrement by (defaults to 1)
* @returns Returns the range of numbers
*/
function range(start?: number, end?: number, step?: number): number[];Like range except that it populates values in descending order.
/**
* This method is like `range` except that it populates values in
* descending order.
* @param start - The start of the range
* @param end - The end of the range
* @param step - The value to increment or decrement by (defaults to 1)
* @returns Returns the range of numbers
*/
function rangeRight(start?: number, end?: number, step?: number): number[];