(text: string)
| 4 | // boolean values will be converted to strings |
| 5 | // return a normal json string |
| 6 | export const parsePermsJSON = (text: string): Result<string> => { |
| 7 | const parseResult = doTry(() => |
| 8 | JsonParser.parse(text, (_key, value) => { |
| 9 | if (value === true) { |
| 10 | return 'true'; |
| 11 | } else if (value === false) { |
| 12 | return 'false'; |
| 13 | } else { |
| 14 | return value; |
| 15 | } |
| 16 | }), |
| 17 | ); |
| 18 | return parseResult; |
| 19 | }; |
| 20 | |
| 21 | export const doTry = <T>(fn: () => T): Result<T> => { |
| 22 | try { |
no test coverage detected