Skip to content

Commit

Permalink
fix: tolerate symbols as property names (#547)
Browse files Browse the repository at this point in the history
* fix: tolerate symbols as property names
  • Loading branch information
erights authored Dec 18, 2020
1 parent 85d2062 commit f16bbc3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/ses/src/enable-property-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ export default function enablePropertyOverrides(intrinsics) {
function setter(newValue) {
if (obj === this) {
throw new TypeError(
`Cannot assign to read only property '${prop}' of '${path}'`,
`Cannot assign to read only property '${String(
prop,
)}' of '${path}'`,
);
}
if (objectHasOwnProperty(this, prop)) {
Expand Down Expand Up @@ -142,8 +144,10 @@ export default function enablePropertyOverrides(intrinsics) {
}

// Plan has no symbol keys and we use getOwnPropertyNames()
// to avoid issues with stringification of property name.
const subPath = `${path}.${prop}`;
// so `prop` cannot only be a string, not a symbol. We coerce it in place
// with `String(..)` anyway just as good hygiene, since these paths are just
// for diagnostic purposes.
const subPath = `${path}.${String(prop)}`;
const subPlan = plan[prop];

if (subPlan === true) {
Expand Down

0 comments on commit f16bbc3

Please sign in to comment.