import { Point } from '../../../utils/point' ; import { SmallMultipleScales } from '../state/selectors/compute_small_multiple_scales' ; type Value = string | number ; internal export interface PerPanelMap { panelAnchor : Point ; horizontalValue : Value ; verticalValue : Value ; } internal export function getPerPanelMap < T > ( scales , fn ) { const { horizontal , vertical } = scales ; return vertical . domain . reduce < Array < T & PerPanelMap > > ( ( acc , verticalValue ) => { return [ ... acc , ... horizontal . domain . reduce < Array < T & PerPanelMap > > ( ( hAcc , horizontalValue ) => { const panelAnchor = { x : horizontal . scale ( horizontalValue ) || 0 , y : vertical . scale ( verticalValue ) || 0 , } ; const fnObj = fn ( panelAnchor , horizontalValue , verticalValue , scales ) ; return fnObj ? [ ... hAcc , { panelAnchor , horizontalValue , verticalValue , ... fnObj } ] : hAcc ; } , [ ] ) , ] ; } , [ ] ) ; }