function to copy objects
This commit is contained in:
@ -30,3 +30,11 @@ test ('try_parse_json should fail', (t) => {
|
||||
t.is (json, null);
|
||||
});
|
||||
});
|
||||
|
||||
test ('copy object', (t) => {
|
||||
const obj = {foo:'bar'};
|
||||
const copy = util.copy_object(obj);
|
||||
copy.foo = 'baz';
|
||||
t.is(copy.foo, 'baz');
|
||||
t.is(obj.foo, 'bar');
|
||||
});
|
||||
|
Reference in New Issue
Block a user