Skip to content

Commit

Permalink
fix: error in published page on reearth/core (#447)
Browse files Browse the repository at this point in the history
fix: error in published page
  • Loading branch information
keiya01 committed Feb 10, 2023
1 parent d6a7425 commit 4c8805a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/core/mantle/compat/forward.ts
Expand Up @@ -211,8 +211,8 @@ function convertLegacyLayerItem(l: LegacyLayer): LayerSimple | undefined {
};
} else {
data = {
type: l.property.default?.type || "auto", // auto is allowed only in internal
url: l.property.default?.url,
type: l.property?.default?.type || "auto", // auto is allowed only in internal
url: l.property?.default?.url,
};
}
} else if (l.extensionId === "box") {
Expand All @@ -238,16 +238,17 @@ function convertLegacyLayerItem(l: LegacyLayer): LayerSimple | undefined {
}
}

const property = appearance
? Object.fromEntries(
Object.entries(l.property)
.flatMap(([k, v]): (readonly [PropertyKey, any])[] | undefined => {
if (Array.isArray(v) || k === "id" || !v || typeof v !== "object") return undefined;
return Object.entries(v).filter(([k]) => !legacyPropertyKeys?.includes(k));
})
.filter((p): p is readonly [PropertyKey, any] => !!p),
)
: undefined;
const property =
appearance && l.property
? Object.fromEntries(
Object.entries(l.property)
.flatMap(([k, v]): (readonly [PropertyKey, any])[] | undefined => {
if (Array.isArray(v) || k === "id" || !v || typeof v !== "object") return undefined;
return Object.entries(v).filter(([k]) => !legacyPropertyKeys?.includes(k));
})
.filter((p): p is readonly [PropertyKey, any] => !!p),
)
: undefined;

return omitBy(
{
Expand Down

0 comments on commit 4c8805a

Please sign in to comment.