Skip to content

Commit

Permalink
Fixes error when XHR has wrapper and returns proper js object instead…
Browse files Browse the repository at this point in the history
… of string
  • Loading branch information
Deema Mykhailov committed Jan 3, 2024
1 parent 26119b5 commit 1f9f8ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ts/speech_rules/math_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ function retrieveFiles(locale: string) {
*
* @param json The json mappings string.
*/
function parseMaps(json: string) {
const js = JSON.parse(json) as { [key: string]: any[] };
function parseMaps(json: string | MathMapJson) {
const js = (typeof json === 'string') ?
JSON.parse(json) as { [key: string]: any[] }
: json;
addMaps(js);
}

Expand Down

0 comments on commit 1f9f8ad

Please sign in to comment.