Skip to content

Commit

Permalink
feat(ses): tolerate non-configurable Symbol props
Browse files Browse the repository at this point in the history
  • Loading branch information
leotm committed Apr 10, 2024
1 parent 983900d commit 22b2c17
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/ses/src/tame-symbol-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,20 @@ export const tameSymbolConstructor = () => {
},
});

const sharedSymbolDescs = getOwnPropertyDescriptors(SharedSymbol);
const originalDescsEntries = entries(
getOwnPropertyDescriptors(OriginalSymbol),
);
const descs = fromEntries(
arrayMap(originalDescsEntries, ([name, desc]) => [
name,
{ ...desc, configurable: true },
]),
arrayMap(originalDescsEntries, ([name, desc]) => {
if (
sharedSymbolDescs[name] &&
sharedSymbolDescs[name].configurable === false
) {
return [name, desc];
}
return [name, { ...desc, configurable: true }];
}),
);
defineProperties(SharedSymbol, descs);

Expand Down

0 comments on commit 22b2c17

Please sign in to comment.