import type { Fn , IObjectOf } from "@thi.ng/api" ; import type { Transducer } from "./api.js" ; import { __iter } from "./iterator.js" ; import { map } from "./map.js" ; /**
 * Transducer. Similar to  {@link (map:1)} , but expects object values and
 * the given function `fn` is applied to each enumerable property value
 * and the results reassigned to their original keys.
 *
 *  remarks example param fn param copy export function mapVals < A , B > ( fn , copy ? ) ; export function mapVals < A , B > ( fn , src ) ; export function mapVals < A , B > ( fn , copy , src ) ; export function mapVals < A , B > ( ... args ) { const iter = __iter ( mapVals , args ) ; if ( iter ) { return iter ; } const fn = args [ 0 ] ; const copy = args [ 1 ] !== false ; return map ( ( x ) => { const res = copy ? { } : x ; for ( let k in x ) { res [ k ] = fn ( x [ k ] ) ; } return < any > res ; } ) ; }