Closed Bug 1065734 Opened 11 years ago Closed 11 years ago

util/object.extend behaves unexpectedly.

Categories

(Add-on SDK Graveyard :: Documentation, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: glind, Unassigned)

Details

https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/util_object I expected this to work: ``` exports['test extend'] = function(assert) { let a = {a: 1}; let b = {b: 2}; let c = extend(a, b); assert.deepEqual(Object.keys(c).sort(), ['a', 'b'], 'cool' ); let a = extend(a,b); assert.deepEqual(Object.keys(a).sort(), ['a', 'b'], 'cool' ); }; ``` Perhaps a doc clarification that the keys are the UNION OF ALL KEYS *but not* those of the first object?
Greg I do believe that is what the documentation says: > Returns an object that inherits from the first argument and contains all of the properties from all following arguments, with precedence from right to left. If you think you can think of way of making it more clear feel free to modify modify wiki page, that's why we moved docs to mdn ;)
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.