negative.js 196 B

123456789
  1. var Traverse = require('traverse');
  2. var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ];
  3. Traverse(obj).forEach(function (x) {
  4. if (x < 0) this.update(x + 128);
  5. });
  6. console.dir(obj);