Skip to content

Commit

Permalink
removed stringify from subheading
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Jan 4, 2022
1 parent 95b5d89 commit 61cbf0a
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/view/ui/Subheading.svelte
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
<script lang="ts">
import type { Monster } from "@types";
import type { SubHeadingItem } from "src/data/constants";
const stringify = (
property: Record<string, any> | string | any[] | number | boolean,
depth: number = 0
): string => {
const ret = [];
if (depth == 5) {
return "";
}
if (typeof property == "string") return property;
if (typeof property == "number") return `${property}`;
if (Array.isArray(property)) {
ret.push(
`(${property.map((p) => stringify(p, depth++)).join(" ")})`
);
} else if (typeof property == "object") {
for (const value of Object.values(property)) {
ret.push(stringify(value, depth++));
}
}
return ret.join(" ");
};
import { stringify } from "../utils";
export let monster: Monster;
export let item: SubHeadingItem;
Expand Down

0 comments on commit 61cbf0a

Please sign in to comment.