UNPKG

covutils

Version:

Utilities for creating, transforming, and handling Coverage Data objects.

20 lines (19 loc) 377 B
/** * Shallow clone a given object. * * Note: This does *not* handle all kinds of objects! * * @ignore */ export function shallowcopy (obj) { let copy if (obj instanceof Map) { copy = new Map(obj) } else { copy = Object.create(Object.getPrototypeOf(obj)) for (let prop in obj) { copy[prop] = obj[prop] } } return copy }