From 876b6d21832ece6c51021fe0acc1d31c2ad4e32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisend=C3=B6rfer?= Date: Sun, 6 Dec 2009 19:02:55 +0100 Subject: [PATCH] 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. --- src/node.js | 2 +- test/mjsunit/test-process-mixin.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/node.js b/src/node.js index 1e091d0289..c8f55c6b07 100644 --- a/src/node.js +++ b/src/node.js @@ -137,7 +137,7 @@ process.mixin = function() { , copy ); // Don't bring in undefined values - else if ( copy !== undefined ) + else target[ name ] = copy; } diff --git a/test/mjsunit/test-process-mixin.js b/test/mjsunit/test-process-mixin.js index 840079a35d..f3578251a2 100644 --- a/test/mjsunit/test-process-mixin.js +++ b/test/mjsunit/test-process-mixin.js @@ -13,4 +13,10 @@ var fakeDomElement = {deep: {nodeType: 4}}; target = {}; process.mixin(true, target, fakeDomElement); -assert.notStrictEqual(target.deep, fakeDomElement.deep); \ No newline at end of file +assert.notStrictEqual(target.deep, fakeDomElement.deep); + +var objectWithUndefinedValue = {foo: undefined}; +target = {}; + +process.mixin(target, objectWithUndefinedValue); +assert.ok(target.hasOwnProperty('foo')); \ No newline at end of file