Skip to content

Commit

Permalink
fix(compartment-mapper): fix #2407 include symbol-named properties
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Aug 13, 2024
1 parent 6ae7995 commit 3efb14f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/compartment-mapper/src/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
policyLookupHelper,
} from './policy-format.js';

const { create, entries, values, assign, keys, freeze } = Object;
const { create, entries, values, assign, freeze, getOwnPropertyDescriptors } =
Object;
const { ownKeys } = Reflect;
const q = JSON.stringify;

/**
Expand All @@ -28,7 +30,12 @@ export const ATTENUATORS_COMPARTMENT = '<ATTENUATORS>';
*/
const selectiveCopy = (from, to, list) => {
if (!list) {
list = keys(from);
const descs = getOwnPropertyDescriptors(from);
list = ownKeys(from).filter(
key =>
// @ts-expect-error TypeScript still confused about a symbol as index
descs[key].enumerable,
);
}
for (let index = 0; index < list.length; index += 1) {
const key = list[index];
Expand Down

0 comments on commit 3efb14f

Please sign in to comment.