Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
Update reference implementation per tc39/ecma262#593 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 27, 2016
1 parent a7dd63f commit c13d24e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions reference-implementation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Object.defineProperty(
}

// Let `ownKeys` be the result of calling ? `obj.[[OwnPropertyKeys]]()`
let ownKeys;
let ownKeys;
try {
ownKeys = Reflect.ownKeys(genericObject);
} catch(e) {
Expand All @@ -47,16 +47,18 @@ Object.defineProperty(
// Let `descriptor` be ? `FromPropertyDescriptor(desc)`
let descriptor = Reflect.getOwnPropertyDescriptor(genericObject, key);

// Let `status` be the result of ? `CreateDataProperty(descriptors, key, descriptor)`
try {
Reflect.defineProperty(descriptors, key, {
configurable: true,
enumerable: true,
writable: true,
value: descriptor
});
} catch(e) {
throw new Error('Unable to create a data propoerty');
if (typeof descriptor !== 'undefined') {
// Let `status` be the result of ? `CreateDataProperty(descriptors, key, descriptor)`
try {
Reflect.defineProperty(descriptors, key, {
configurable: true,
enumerable: true,
writable: true,
value: descriptor
});
} catch(e) {
throw new Error('Unable to create a data propoerty');
}
}
}

Expand Down

0 comments on commit c13d24e

Please sign in to comment.