Skip to content

Commit fb2b70f

Browse files
committed
string check for json parse
1 parent 49829ec commit fb2b70f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/util/get-all-features.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ export default async function (data: { apiKey: string, api: string, project: str
1313
const features: Record<string, IFlagsmithFeature['value']> = {}
1414
for (const key of Object.keys(instance.getAllFlags())) {
1515
let value = instance.getValue(key)
16-
try {
17-
value = JSON.parse(instance.getValue(key))
18-
} catch {}
16+
if (typeof value === 'string') {
17+
try {
18+
value = JSON.parse(value)
19+
} catch {}
20+
}
1921

2022
features[key] = value
2123
}

0 commit comments

Comments
 (0)