Skip to content

Commit

Permalink
Merge pull request #743 from DeemaMykhailov/feature/fix-error-when-xh…
Browse files Browse the repository at this point in the history
…r-has-interceptor-and-returns-js-object

Fixes error when XHR has wrapper and returns proper js object instead the string.
  • Loading branch information
zorkow authored Jan 16, 2024
2 parents 8b7fea6 + 1f9f8ad commit abed8c8
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 abed8c8

Please sign in to comment.