1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.shallowcopy = shallowcopy;
|
7 | /**
|
8 | * Shallow clone a given object.
|
9 | *
|
10 | * Note: This does *not* handle all kinds of objects!
|
11 | *
|
12 | * @ignore
|
13 | */
|
14 | function shallowcopy(obj) {
|
15 | var copy = void 0;
|
16 | if (obj instanceof Map) {
|
17 | copy = new Map(obj);
|
18 | } else {
|
19 | copy = Object.create(Object.getPrototypeOf(obj));
|
20 | for (var prop in obj) {
|
21 | copy[prop] = obj[prop];
|
22 | }
|
23 | }
|
24 | return copy;
|
25 | } |
\ | No newline at end of file |