replace-all-mustaches 0.0.3 → 0.0.5

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
@@ -4,3 +4,14 @@ Replace all mustache templates in a string, including recursive mustache values
4
4
  # install
5
5
  ``npm i replace-all-mustaches``
6
6
 
7
+ # elements
8
+ ## VariableView
9
+ A mustache view containing any number of [].
10
+
11
+ All views are accessed are accessed during [replaceAllMustaches()](#replaceallmustaches), which looks at the base class's static collection.
12
+
13
+ ## Variable
14
+ The variables that fill a [VariableView](#variableview), consisting of a key and a value
15
+
16
+ ## replaceAllMustaches
17
+ The main function: iterates over the static collection of the [VariableView](#variableview) class, including all of the [Variables](#variable) created.
package/dist/index.cjs CHANGED
@@ -34,7 +34,7 @@ __export(index_exports, {
34
34
  VariableView: () => VariableView,
35
35
  hasDuplicates: () => hasDuplicates,
36
36
  hasMustacheTags: () => hasMustacheTags,
37
- renderUntilStable: () => renderUntilStable
37
+ replaceAllMustaches: () => replaceAllMustaches
38
38
  });
39
39
  module.exports = __toCommonJS(index_exports);
40
40
 
@@ -86,7 +86,7 @@ var VariableView = class _VariableView {
86
86
  };
87
87
 
88
88
  // src/nodes/replaceAllMustaches.ts
89
- function renderUntilStable(template, view, { maxPasses = 20, detectCycles = true } = {}) {
89
+ function replaceAllMustaches(template, view, { maxPasses = 20, detectCycles = true } = {}) {
90
90
  let current = template;
91
91
  const seen = /* @__PURE__ */ new Set();
92
92
  let pass = 0;
@@ -131,5 +131,5 @@ var Variable = class {
131
131
  VariableView,
132
132
  hasDuplicates,
133
133
  hasMustacheTags,
134
- renderUntilStable
134
+ replaceAllMustaches
135
135
  });
package/dist/index.d.cts CHANGED
@@ -30,10 +30,10 @@ declare class VariableView {
30
30
  replace(variableKey: string, value: string | Function): void;
31
31
  }
32
32
 
33
- type replaceAllMustaches = {
33
+ type MustacheIterationOptions = {
34
34
  maxPasses?: number;
35
35
  detectCycles?: boolean;
36
36
  };
37
- declare function renderUntilStable(template: string, view: VariableView, { maxPasses, detectCycles }?: replaceAllMustaches): string;
37
+ declare function replaceAllMustaches(template: string, view: VariableView, { maxPasses, detectCycles }?: MustacheIterationOptions): string;
38
38
 
39
- export { type MustacheValue, Variable, VariableView, hasDuplicates, hasMustacheTags, renderUntilStable };
39
+ export { type MustacheValue, Variable, VariableView, hasDuplicates, hasMustacheTags, replaceAllMustaches };
package/dist/index.d.ts CHANGED
@@ -30,10 +30,10 @@ declare class VariableView {
30
30
  replace(variableKey: string, value: string | Function): void;
31
31
  }
32
32
 
33
- type replaceAllMustaches = {
33
+ type MustacheIterationOptions = {
34
34
  maxPasses?: number;
35
35
  detectCycles?: boolean;
36
36
  };
37
- declare function renderUntilStable(template: string, view: VariableView, { maxPasses, detectCycles }?: replaceAllMustaches): string;
37
+ declare function replaceAllMustaches(template: string, view: VariableView, { maxPasses, detectCycles }?: MustacheIterationOptions): string;
38
38
 
39
- export { type MustacheValue, Variable, VariableView, hasDuplicates, hasMustacheTags, renderUntilStable };
39
+ export { type MustacheValue, Variable, VariableView, hasDuplicates, hasMustacheTags, replaceAllMustaches };
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ var VariableView = class _VariableView {
46
46
  };
47
47
 
48
48
  // src/nodes/replaceAllMustaches.ts
49
- function renderUntilStable(template, view, { maxPasses = 20, detectCycles = true } = {}) {
49
+ function replaceAllMustaches(template, view, { maxPasses = 20, detectCycles = true } = {}) {
50
50
  let current = template;
51
51
  const seen = /* @__PURE__ */ new Set();
52
52
  let pass = 0;
@@ -90,5 +90,5 @@ export {
90
90
  VariableView,
91
91
  hasDuplicates,
92
92
  hasMustacheTags,
93
- renderUntilStable
93
+ replaceAllMustaches
94
94
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replace-all-mustaches",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
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",
@@ -2,15 +2,15 @@ import Mustache from "mustache";
2
2
  import { VariableView } from "./VariableView";
3
3
  import { hasMustacheTags } from "./helperFunctions";
4
4
 
5
- type replaceAllMustaches = {
5
+ type MustacheIterationOptions = {
6
6
  maxPasses?: number;
7
7
  detectCycles?: boolean;
8
8
  };
9
9
 
10
- export function renderUntilStable(
10
+ export function replaceAllMustaches(
11
11
  template: string,
12
12
  view: VariableView,
13
- { maxPasses = 20, detectCycles = true }: replaceAllMustaches = {},
13
+ { maxPasses = 20, detectCycles = true }: MustacheIterationOptions = {},
14
14
  ): string {
15
15
  let current = template;
16
16
  const seen = new Set<string>();