How to use the forEach function from traverse

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

11
12
13
14
15
16
17
18
19
20
21
    assert.deepEqual(obj, { a : 1, b : 20, c : [ 3, 40 ] });
};


exports.mutateT = function () {
    var obj = { a : 1, b : 2, c : [ 3, 4 ] };
    var res = Traverse.forEach(obj, function (x) {
        if (typeof x === 'number' && x % 2 === 0) {
            this.update(x * 10);
        }
    });
fork icon0
star icon0
watch icon1