Browse Source

Make process.mixin copy over undefined values

This is not a bug in process.mixin, but I think it is undesirable
behavior. Right now process.mixin will not copy over keys with undefined
values. To me that is an unexpected filtering that should not happen
unless specifically called for.
v0.7.4-release
Felix Geisendörfer 15 years ago
committed by Ryan Dahl
parent
commit
876b6d2183
  1. 2
      src/node.js
  2. 8
      test/mjsunit/test-process-mixin.js

2
src/node.js

@ -137,7 +137,7 @@ process.mixin = function() {
, copy ); , copy );
// Don't bring in undefined values // Don't bring in undefined values
else if ( copy !== undefined ) else
target[ name ] = copy; target[ name ] = copy;
} }

8
test/mjsunit/test-process-mixin.js

@ -13,4 +13,10 @@ var fakeDomElement = {deep: {nodeType: 4}};
target = {}; target = {};
process.mixin(true, target, fakeDomElement); process.mixin(true, target, fakeDomElement);
assert.notStrictEqual(target.deep, fakeDomElement.deep); assert.notStrictEqual(target.deep, fakeDomElement.deep);
var objectWithUndefinedValue = {foo: undefined};
target = {};
process.mixin(target, objectWithUndefinedValue);
assert.ok(target.hasOwnProperty('foo'));
Loading…
Cancel
Save