@plurid/plurid-functions
Version:
General Utility Functions for Plurid Applications
31 lines (30 loc) • 892 B
TypeScript
export declare enum OPERATION_TYPES {
SUM = "SUM",
PRODUCT = "PRODUCT",
DIFFERENCE = "DIFFERENCE"
}
/**
* Operate on the `values` up to the given `index` based the specific `operation`.
* If the `index` is not given it operates to the end.
*
* @param type
* @param values
* @param index
*/
export declare const operation: (type: keyof typeof OPERATION_TYPES, values: number[], index?: number) => number;
/**
* Sum the `values` up to the given `index`.
* If the `index` is not given it sums to the end.
*
* @param values
* @param index
*/
export declare const sum: (values: number[], index?: number) => number;
/**
* Multiply the `values` up to the given `index`.
* If the `index` is not given it multiplies to the end.
*
* @param values
* @param index
*/
export declare const product: (values: number[], index?: number) => number;