sendou.ink/app/utils/json.ts
Kalle b6283a89c5
Build filters (#1382)
* Build filters WIP

* Move builds to feature folder

* Move stuff to builds feature folder

* Working filters

* AP values as dropdown

* Should revalidate logic

* Remove debounce

* Fix main ability filter not working by default

* Persist filters to search params

* Disable button if too many filters

* Stack on mobile

* Abilities in i18n json

* Ability icon in filter

* Add i18n

* E2E test

* Remove done todo
2023-06-04 11:37:05 +03:00

8 lines
153 B
TypeScript

export function safeJSONParse<T>(json: string, defaultValue: T): T {
try {
return JSON.parse(json);
} catch (e) {
return defaultValue;
}
}