@firebase/util 1.15.1 → 1.15.2-20260728185501
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.esm.js
CHANGED
|
@@ -1020,12 +1020,34 @@ class ErrorFactory {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
function replaceTemplate(template, data) {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1023
|
+
try {
|
|
1024
|
+
let ptr = 0;
|
|
1025
|
+
let result = '';
|
|
1026
|
+
while (ptr < template.length) {
|
|
1027
|
+
const start = template.indexOf('{$', ptr);
|
|
1028
|
+
if (start === -1) {
|
|
1029
|
+
result += template.substring(ptr);
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
1032
|
+
const end = template.indexOf('}', start + 2);
|
|
1033
|
+
if (end === -1) {
|
|
1034
|
+
result += template.substring(ptr);
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
const key = template.substring(start + 2, end);
|
|
1038
|
+
const value = data[key];
|
|
1039
|
+
result +=
|
|
1040
|
+
template.substring(ptr, start) +
|
|
1041
|
+
(value != null ? String(value) : `<${key}?>`);
|
|
1042
|
+
ptr = end + 1;
|
|
1043
|
+
}
|
|
1044
|
+
return result;
|
|
1045
|
+
}
|
|
1046
|
+
catch (e) {
|
|
1047
|
+
// Should never happen, but fallback just in case
|
|
1048
|
+
return template;
|
|
1049
|
+
}
|
|
1027
1050
|
}
|
|
1028
|
-
const PATTERN = /\{\$([^}]+)}/g;
|
|
1029
1051
|
|
|
1030
1052
|
/**
|
|
1031
1053
|
* @license
|