quantitivecalc
Version:
A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)
44 lines • 1.79 kB
TypeScript
/**
* Configuration for range boundary behavior.
*/
export interface RangeBoundaryConfig {
/** Whether the minimum boundary is inclusive (>=) or exclusive (>) */
minInclusive?: boolean;
/** Whether the maximum boundary is inclusive (<=) or exclusive (<) */
maxInclusive?: boolean;
}
/**
* Analyzes items in a list based on a specified column and optional range constraints.
* Provides comprehensive information about extremes, range filtering, and statistical insights.
*
* @template T - The type of objects in the list.
* @template K - The key of the column to compare, must be a key of T with comparable values.
* @param list - The array of objects to search.
* @param columnName - The key of the column to analyze.
* @param minValue - Optional minimum value for range filtering.
* @param maxValue - Optional maximum value for range filtering.
* @param boundaryConfig - Configuration for boundary inclusion/exclusion behavior.
* @returns An object containing comprehensive analysis results.
*/
export default function analyzeColumnWithRange<T, K extends keyof T>(list: T[], columnName: K, minValue?: T[K], maxValue?: T[K], boundaryConfig?: RangeBoundaryConfig): {
min: T | undefined;
max: T | undefined;
itemsInRange: T[];
itemsOutOfRange: T[];
itemsBelowMin: T[];
itemsAboveMax: T[];
totalItems: number;
itemsInRangeCount: number;
itemsOutOfRangeCount: number;
percentageInRange: number;
minInRange: T | undefined;
maxInRange: T | undefined;
isRangeValid: boolean;
rangeSpan: T[K] | undefined;
itemsAtMinBoundary: T[];
itemsAtMaxBoundary: T[];
hasItemsInRange: boolean;
hasItemsOutOfRange: boolean;
allItemsInRange: boolean;
};
//# sourceMappingURL=analyzeColumnWithRange.d.ts.map