How to use the clone function from traverse

Find comprehensive JavaScript traverse.clone code examples handpicked from public code repositorys.

55
56
57
58
59
60
61
62
63
64
65
    assert.deepEqual(res.c, [ 3, 4 ]);
};


exports.cloneT = function () {
    var obj = { a : 1, b : 2, c : [ 3, 4 ] };
    var res = Traverse.clone(obj);
    assert.deepEqual(obj, res);
    assert.ok(obj !== res);
    obj.a ++;
    assert.deepEqual(res.a, 1);
fork icon0
star icon0
watch icon1