replace-all-mustaches 0.0.5 → 0.0.7

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
@@ -6,7 +6,7 @@ Replace all mustache templates in a string, including recursive mustache values
6
6
 
7
7
  # elements
8
8
  ## VariableView
9
- A mustache view containing any number of [].
9
+ A mustache view containing any number of [variables](#variable).
10
10
 
11
11
  All views are accessed are accessed during [replaceAllMustaches()](#replaceallmustaches), which looks at the base class's static collection.
12
12
 
package/dist/index.cjs CHANGED
@@ -86,7 +86,7 @@ var VariableView = class _VariableView {
86
86
  };
87
87
 
88
88
  // src/nodes/replaceAllMustaches.ts
89
- function replaceAllMustaches(template, view, { maxPasses = 20, detectCycles = true } = {}) {
89
+ function replaceAllMustaches(template, { maxPasses = 20, detectCycles = true } = {}) {
90
90
  let current = template;
91
91
  const seen = /* @__PURE__ */ new Set();
92
92
  let pass = 0;
package/dist/index.d.cts CHANGED
@@ -6,6 +6,12 @@
6
6
  declare function hasMustacheTags(template: string): boolean;
7
7
  declare function hasDuplicates(arr: any[]): boolean;
8
8
 
9
+ type MustacheIterationOptions = {
10
+ maxPasses?: number;
11
+ detectCycles?: boolean;
12
+ };
13
+ declare function replaceAllMustaches(template: string, { maxPasses, detectCycles }?: MustacheIterationOptions): string;
14
+
9
15
  type MustacheValue = string | string[] | Function;
10
16
  /**
11
17
  * A key-value pair for a variable name and its value.
@@ -30,10 +36,4 @@ declare class VariableView {
30
36
  replace(variableKey: string, value: string | Function): void;
31
37
  }
32
38
 
33
- type MustacheIterationOptions = {
34
- maxPasses?: number;
35
- detectCycles?: boolean;
36
- };
37
- declare function replaceAllMustaches(template: string, view: VariableView, { maxPasses, detectCycles }?: MustacheIterationOptions): string;
38
-
39
39
  export { type MustacheValue, Variable, VariableView, hasDuplicates, hasMustacheTags, replaceAllMustaches };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,12 @@
6
6
  declare function hasMustacheTags(template: string): boolean;
7
7
  declare function hasDuplicates(arr: any[]): boolean;
8
8
 
9
+ type MustacheIterationOptions = {
10
+ maxPasses?: number;
11
+ detectCycles?: boolean;
12
+ };
13
+ declare function replaceAllMustaches(template: string, { maxPasses, detectCycles }?: MustacheIterationOptions): string;
14
+
9
15
  type MustacheValue = string | string[] | Function;
10
16
  /**
11
17
  * A key-value pair for a variable name and its value.
@@ -30,10 +36,4 @@ declare class VariableView {
30
36
  replace(variableKey: string, value: string | Function): void;
31
37
  }
32
38
 
33
- type MustacheIterationOptions = {
34
- maxPasses?: number;
35
- detectCycles?: boolean;
36
- };
37
- declare function replaceAllMustaches(template: string, view: VariableView, { maxPasses, detectCycles }?: MustacheIterationOptions): string;
38
-
39
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 replaceAllMustaches(template, view, { maxPasses = 20, detectCycles = true } = {}) {
49
+ function replaceAllMustaches(template, { maxPasses = 20, detectCycles = true } = {}) {
50
50
  let current = template;
51
51
  const seen = /* @__PURE__ */ new Set();
52
52
  let pass = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replace-all-mustaches",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
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",
@@ -9,7 +9,6 @@ type MustacheIterationOptions = {
9
9
 
10
10
  export function replaceAllMustaches(
11
11
  template: string,
12
- view: VariableView,
13
12
  { maxPasses = 20, detectCycles = true }: MustacheIterationOptions = {},
14
13
  ): string {
15
14
  let current = template;