We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
formatValues
1 parent 2dfd553 commit 25be256Copy full SHA for 25be256
dotcom-rendering/src/devServer/docs/article.tsx
@@ -95,6 +95,17 @@ const Examples = () => (
95
</>
96
);
97
98
+/**
99
+ * Joins all the `string` values of an enum into a single, comma-separated
100
+ * `string`.
101
+ *
102
+ * `ArticleDesign`, `ArticleDisplay` and the two variants of `ArticleTheme` are
103
+ * TypeScript enums. Their values contain both the `string` and `number`
104
+ * representations of the enum, but here we just want the `string`s, so we
105
+ * filter out the `number`s.
106
107
+ * https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings
108
+ */
109
const formatValues = (a: object): string =>
110
Object.values(a)
111
.filter((v) => typeof v !== 'number')
0 commit comments