Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/a11ystring-plugin' into a11ystri…
Browse files Browse the repository at this point in the history
…ng-plugin
  • Loading branch information
zepumph committed Sep 24, 2019
2 parents 8898587 + 163a9b4 commit 4cc9e98
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions js/common/ChipperStringUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
if ( result.value === undefined ) {
throw new Error( `no value for string: ${key}` );
}
if ( typeof result.value !== 'string' ) {
throw new Error( `value should be a string for key ${key}` );
}
return result.value;
}

Expand All @@ -162,10 +165,9 @@
},

/**
* Call a function on each string object in a string map. Recursively dive into each object that doesn't have a
* `value` to find nested string objects too.
* @param {StringMap} map - string map, like a loaded JSON strings file
* @param {function(key:string, StringObject)} func
* Call a function on each object with a value attribute in an object tree.
* @param {Object.<string, Object|{value:string}>} map - string map, like a loaded JSON strings file
* @param {function(key:string, {value:string})} func
* @public
*/
forEachString( map, func ) {
Expand Down

0 comments on commit 4cc9e98

Please sign in to comment.