MCPcopy Index your code
hub / github.com/plotly/dash / matrixMap2

Function matrixMap2

components/dash-table/src/core/math/matrixZipMap.ts:75–96  ·  view source on GitHub ↗
(
    m1: Matrix<T1>,
    m2: Matrix<T2> | undefined,
    fn: (d1: T1, d2: T2 | undefined, i: number, j: number) => TR
)

Source from the content-addressed store, hash-verified

73}
74
75export function matrixMap2<T1, T2, TR>(
76 m1: Matrix<T1>,
77 m2: Matrix<T2> | undefined,
78 fn: (d1: T1, d2: T2 | undefined, i: number, j: number) => TR
79): Matrix<TR> {
80 const _m1_ = m1.length;
81
82 const res: Matrix<TR> = new Array<TR[]>(_m1_);
83
84 for (let i = 0; i < _m1_; ++i) {
85 const _row_ = m1[i].length;
86 const row = new Array<TR>(_row_);
87
88 for (let j = 0; j < _row_; ++j) {
89 row[j] = fn(m1[i][j], m2 ? m2[i][j] : undefined, i, j);
90 }
91
92 res[i] = row;
93 }
94
95 return res;
96}
97
98export function matrixMap3<T1, T2, T3, TR>(
99 m1: Matrix<T1>,

Callers 2

CellFactoryClass · 0.90
HeaderFactoryClass · 0.90

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…