mapProps()function
mapProps(obj: I, transform: (prop: Prop<I>, ...args: A) => Value<O>, ...args: A): O
| Param | Type | |
|---|---|---|
obj | I | The source object. required |
transform | (prop: Prop<I>, ...args: A) => Value<O> | Function applied to each [key, value] prop to produce the output value. required |
args | A | Additional arguments passed through to transform on every call. required |
| Return | |
|---|---|
O | A new object with the same keys and transformed values. |
Transform the values of an object's props into a new object.
- Keys are preserved; each prop entry is passed to
transformto produce its new value.
Examples
mapProps({ a: 1, b: 2 }, ([, v]) => v * 2) // { a: 2, b: 4 }