Type Alias MapValuesFn<S, R>

MapValuesFn<S, R>: ((value: S[keyof S], key: keyof S) => R)

A callback function to mapValues. It should return new value, optionally may return exported mapValuesUnset value to unset a property in the target the object.

Type Parameters

  • S
  • R

Type declaration

    • (value, key): R
    • Parameters

      • value: S[keyof S]

        property value

      • key: keyof S

        property name

      Returns R

      • new value of a property
function fn(value, key) { return value * 5; } // all properties will be multiplied
function fn(value, key) {
if (key === "name") {
return mapValuesUNSET;
}
return value.toUpperCase();
} // will upper case all properties and filter out name property