Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tolerate symbols as property names #547

Merged
merged 2 commits into from
Dec 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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