Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Latest commit

 

History

History
53 lines (43 loc) · 2.15 KB

mapOwn.md

File metadata and controls

53 lines (43 loc) · 2.15 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
callback function Provides two args: value and key
[ignoreKeys] Array, String Any keys in this array will 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' }