Skip to content

Latest commit

 

History

History
53 lines (43 loc) · 2.17 KB

mapOwn.md

File metadata and controls

53 lines (43 loc) · 2.17 KB

Object Agent

A javascript library for working with objects

npm build coverage deps size vulnerabilities license


mapOwn(object, callback, [ignoreKeys]) ⇒ object | *

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' }