@vdhewei/xlsx-template-lib 1.3.2 → 1.3.4

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.js CHANGED
@@ -3076,14 +3076,20 @@ var extractMacro = function(expr, options) {
3076
3076
  return extracResult;
3077
3077
  };
3078
3078
  var __codeKey = (str) => {
3079
- let vs = str.trim().replace("-", "_").replace("/", "_").trim();
3080
- for (; vs.indexOf("__") >= 0; ) {
3081
- vs = vs.replace("__", "_");
3079
+ const replaces = [" ", `-`, `/`, `,`, `'`, `&`, `.`, `(`, `)`, `{`, `}`, `@`, `\\`, `[`, `]`, `#`, `:`];
3080
+ for (const k of replaces) {
3081
+ str = str.replaceAll(k, "_").trim();
3082
+ if (str.indexOf("__") >= 0) {
3083
+ str = str.replaceAll("__", "_");
3084
+ }
3085
+ }
3086
+ if (str.startsWith("_")) {
3087
+ str = str.substring(1);
3082
3088
  }
3083
- for (; vs.indexOf(" ") >= 0; ) {
3084
- vs = vs.replace(" ", "");
3089
+ if (str.endsWith("_")) {
3090
+ str = str.substring(0, str.length - 1);
3085
3091
  }
3086
- return vs.trim().toUpperCase();
3092
+ return str.toUpperCase();
3087
3093
  };
3088
3094
  var __numberKey = (str) => {
3089
3095
  return Number.parseInt(str, 10).toString();