We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
anymaniax
melloware
soartec-lab
Learn more about funding links in repositories.
Report abuse
null
''
1 parent 461e813 commit c41635bCopy full SHA for c41635b
packages/mock/src/faker/getters/scalar.ts
@@ -211,8 +211,12 @@ export const getMockScalar = ({
211
if (item.enum) {
212
// By default the value isn't a reference, so we don't have the object explicitly defined.
213
// So we have to create an array with the enum values and force them to be a const.
214
- let enumValue =
215
- "['" + item.enum.map((e) => escape(e)).join("','") + "'] as const";
+ const joindEnumValues = item.enum
+ .filter(Boolean)
216
+ .map((e) => escape(e))
217
+ .join("','");
218
+
219
+ let enumValue = `['${joindEnumValues}'] as const`;
220
221
// But if the value is a reference, we can use the object directly via the imports and using Object.values.
222
if (item.isRef) {
0 commit comments