import type { IObjectOf , Pair } from "@thi.ng/api" ; import type { Reducer } from "./api.js" ; import { reduce , reducer } from "./reduce.js" ; /**
 * Reducer accepting key-value pairs / tuples and updating / adding them
 * to an object.
 */ export function assocObj < T > ( ) ; export function assocObj < T > ( xs ) ; export function assocObj < T > ( xs ? ) { return xs ? reduce ( assocObj ( ) , xs ) : reducer < IObjectOf < T > , Pair < PropertyKey , T > > ( ( ) => ( { } ) , ( acc , [ k , v ] ) => ( ( acc [ < any > k ] = v ) , acc ) ) ; }