or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

array-methods.mdcollection-methods.mdfunction-methods.mdindex.mdlang-methods.mdmath-methods.mdobject-methods.mdstring-methods.mdutil-methods.md
tile.json

math-methods.mddocs/

Math Methods

Mathematical computations including basic arithmetic, aggregation functions, and range utilities for numerical operations.

Capabilities

Add

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;

Ceil

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

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;

Floor

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;

Max

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;

Max By

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;

Mean

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;

Mean By

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;

Min

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;

Min By

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

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;

Round

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

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;

Sum

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;

Sum By

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;

Range Methods

In Range

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;

Range

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[];

Range Right

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[];