UNPKG

quantitivecalc

Version:

A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)

17 lines (16 loc) 707 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = applyFunctionToFlattened; /** * Applies a function to a flattened array created from all the arrays in the given dictionary. * * @template T - The type of elements in the input arrays. * @template R - The return type of the function. * @param dict - A dictionary where each value is an array of type T. * @param func - A function that takes a flattened array of type T and returns a value of type R. * @returns The result of applying `func` to the flattened array. */ function applyFunctionToFlattened(dict, func) { const flattenedList = Object.values(dict).flat(); return func(flattenedList); }