A javascript library for working with objects
Builds a new object by iterating over own properties of an object.
Returns: object
| *
- If null or undefined are passed in then the same is returned, otherwise a new object
Param | Type | Description |
---|---|---|
object | object |
The object to map. |
callback | function |
Provides two args: value and key. |
[ignoreKeys] | Array , string |
Any keys that should be ignored. |
Example
import { mapOwn } from 'object-agent';
const thing = {
a: 'b',
c: 'd'
};
mapOwn(thing, (value, key) => value + ' ' + key);
// => { a: 'b a', c: 'd c' }