UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

26 lines 676 B
/** * Verify this works in FPSTextInput... there may have been a reason not to use it. * @param jsonString * @returns */ export function isValidJSON2(jsonString) { try { // eslint-disable-next-line @typescript-eslint/no-unused-vars const jsonObject = JSON.parse(jsonString); return true; } catch (e) { console.log('Invalid JSON string:', e); return false; } } // TextInput was using this before. // function isValidJSON(str: string): boolean { // try { // JSON.parse(str); // return true; // } catch (e) { // return false; // } // } //# sourceMappingURL=isValidJSON2.js.map