replace-all-mustaches 0.0.9 → 0.0.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.
package/README.md CHANGED
@@ -14,4 +14,7 @@ All views are accessed are accessed during [replaceAllMustaches()](#replaceallmu
14
14
  The variables that fill a [VariableView](#variableview), consisting of a key and a value
15
15
 
16
16
  ## replaceAllMustaches
17
- The main function: iterates over the static collection of the [VariableView](#variableview) class, including all of the [Variables](#variable) created.
17
+ The main function: iterates over the static collection of the [VariableView](#variableview) class, including all of the [Variables](#variable) created.
18
+
19
+ # updating
20
+ I wrote myself instructions, based on a video: https://www.npmjs.com/package/sow-test-package
package/dist/index.cjs CHANGED
@@ -98,7 +98,7 @@ function replaceAllMustaches(template, { maxPasses = 20, detectCycles = true } =
98
98
  }
99
99
  ;
100
100
  const next = import_mustache.default.render(current, VariableView.all);
101
- if (next !== "" && next === current) {
101
+ if (next.trim() !== "" && next !== current) {
102
102
  current = next;
103
103
  } else {
104
104
  return current;
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ function replaceAllMustaches(template, { maxPasses = 20, detectCycles = true } =
58
58
  }
59
59
  ;
60
60
  const next = Mustache.render(current, VariableView.all);
61
- if (next !== "" && next === current) {
61
+ if (next.trim() !== "" && next !== current) {
62
62
  current = next;
63
63
  } else {
64
64
  return current;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replace-all-mustaches",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Replace all mustache templates in a string, including recursive mustache values",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -33,7 +33,7 @@ export function replaceAllMustaches(
33
33
  const next = Mustache.render(current, VariableView.all);
34
34
 
35
35
  // If the string's not empty and it's not the same as the current string...
36
- if (next !== "" && next === current){
36
+ if (next.trim() !== "" && next !== current){
37
37
  current = next;
38
38
  } else {
39
39
  return current; // no more substitutions happened