mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
876b6d2183
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.
22 lines
590 B
JavaScript
22 lines
590 B
JavaScript
process.mixin(require("./common"));
|
|
|
|
var target = function() {};
|
|
process.mixin(target, {
|
|
foo: 'bar'
|
|
});
|
|
|
|
assert.equal('bar', target.foo);
|
|
|
|
// This test verifies there are no DOM-related aspects to process.mixin which
|
|
// originally had been in there due to its jQuery origin.
|
|
var fakeDomElement = {deep: {nodeType: 4}};
|
|
target = {};
|
|
process.mixin(true, target, fakeDomElement);
|
|
|
|
assert.notStrictEqual(target.deep, fakeDomElement.deep);
|
|
|
|
var objectWithUndefinedValue = {foo: undefined};
|
|
target = {};
|
|
|
|
process.mixin(target, objectWithUndefinedValue);
|
|
assert.ok(target.hasOwnProperty('foo')); |