feat: rewrite d2c to not require token (#8269)

This commit is contained in:
David Luzar 2024-08-20 18:06:22 +02:00 committed by GitHub
parent fb4bb29aa5
commit b5d7f5b4ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 282 additions and 564 deletions

View file

@ -1166,3 +1166,11 @@ export const promiseTry = async <TValue, TArgs extends unknown[]>(
export const isAnyTrue = (...args: boolean[]): boolean =>
Math.max(...args.map((arg) => (arg ? 1 : 0))) > 0;
export const safelyParseJSON = (json: string): Record<string, any> | null => {
try {
return JSON.parse(json);
} catch {
return null;
}
};