@followupus/common 0.10.9 → 0.10.11

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.
@@ -43,15 +43,15 @@ export function truncateString(str, maxLength) {
43
43
  return str;
44
44
  }
45
45
  }
46
- //** case insensitive
47
- //** {Who} can be replaced by variable {who:{name:ttt}}
46
+ //case insensitive
47
+ //** {{Who}} can be replaced by variable {who:{name:ttt}}
48
48
  export function formatTemplate(text, rawVariables, maxLength = Number.MAX_SAFE_INTEGER) {
49
- const matches = text?.match(/{([^}]+)}/g);
49
+ const matches = text?.match(/{{([^}]+)}}/g);
50
50
  if (matches) {
51
51
  const formatVariables = keysToLowerCase(rawVariables);
52
52
  let finalStr = text || "";
53
53
  matches.forEach((match) => {
54
- const variableKey = match.slice(1, match.length - 1)?.toLowerCase();
54
+ const variableKey = match.slice(2, match.length - 2)?.toLowerCase();
55
55
  if (Object.keys(formatVariables).includes(variableKey)) {
56
56
  const variable = formatVariables[variableKey] || {};
57
57
  finalStr = finalStr.replace(match, typeof variable === "string" ? variable : getTextValue(variable));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@followupus/common",
3
- "version": "0.10.9",
3
+ "version": "0.10.11",
4
4
  "description": "followup common utils npm package with TypeScript and VSCode",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",