@firebase/util 1.15.1-eap-crashlytics.558ee841d → 1.15.1-eap-crashlytics.659b578fb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +27 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +27 -5
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +27 -5
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs.js
CHANGED
|
@@ -1024,12 +1024,34 @@ class ErrorFactory {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
function replaceTemplate(template, data) {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1027
|
+
try {
|
|
1028
|
+
let ptr = 0;
|
|
1029
|
+
let result = '';
|
|
1030
|
+
while (ptr < template.length) {
|
|
1031
|
+
const start = template.indexOf('{$', ptr);
|
|
1032
|
+
if (start === -1) {
|
|
1033
|
+
result += template.substring(ptr);
|
|
1034
|
+
break;
|
|
1035
|
+
}
|
|
1036
|
+
const end = template.indexOf('}', start + 2);
|
|
1037
|
+
if (end === -1) {
|
|
1038
|
+
result += template.substring(ptr);
|
|
1039
|
+
break;
|
|
1040
|
+
}
|
|
1041
|
+
const key = template.substring(start + 2, end);
|
|
1042
|
+
const value = data[key];
|
|
1043
|
+
result +=
|
|
1044
|
+
template.substring(ptr, start) +
|
|
1045
|
+
(value != null ? String(value) : `<${key}?>`);
|
|
1046
|
+
ptr = end + 1;
|
|
1047
|
+
}
|
|
1048
|
+
return result;
|
|
1049
|
+
}
|
|
1050
|
+
catch (e) {
|
|
1051
|
+
// Should never happen, but fallback just in case
|
|
1052
|
+
return template;
|
|
1053
|
+
}
|
|
1031
1054
|
}
|
|
1032
|
-
const PATTERN = /\{\$([^}]+)}/g;
|
|
1033
1055
|
|
|
1034
1056
|
/**
|
|
1035
1057
|
* @license
|