lang-json 1.0.3 → 213.21.24
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of lang-json might be problematic. Click here for more details.
- package/index.js +34 -0
- package/package.json +7 -57
- package/README.md +0 -0
- package/babel.config.js +0 -8
- package/coverage/clover.xml +0 -6
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -0
- package/dist/esm/src/index.d.ts +0 -18
- package/dist/esm/src/index.js +0 -369
- package/dist/esm/src/index.js.map +0 -1
- package/dist/esm/src/modules/is-this/index.d.ts +0 -136
- package/dist/esm/src/modules/is-this/index.js +0 -484
- package/dist/esm/src/modules/is-this/index.js.map +0 -1
- package/dist/esm/tests/helpers.test.d.ts +0 -1
- package/dist/esm/tests/helpers.test.js +0 -284
- package/dist/esm/tests/helpers.test.js.map +0 -1
- package/dist/esm/tests/index.test.d.ts +0 -1
- package/dist/esm/tests/index.test.js +0 -537
- package/dist/esm/tests/index.test.js.map +0 -1
- package/dist/esm/tests/readme.test.d.ts +0 -1
- package/dist/esm/tests/readme.test.js +0 -73
- package/dist/esm/tests/readme.test.js.map +0 -1
- package/jest.config.ts +0 -212
- package/src/index.ts +0 -467
- package/src/modules/is-this/index.ts +0 -682
- package/tests/helpers.test.ts +0 -331
- package/tests/index.test.ts +0 -681
- package/tests/readme.test.ts +0 -78
- package/tsconfig.json +0 -16
@@ -1,537 +0,0 @@
|
|
1
|
-
import LangJSON from "../src/index";
|
2
|
-
const langJson = new LangJSON();
|
3
|
-
describe("LangJSON Test Suite", () => {
|
4
|
-
/**
|
5
|
-
* -------------------------
|
6
|
-
* Test: lookup method
|
7
|
-
* -------------------------
|
8
|
-
*/
|
9
|
-
test("Basic lookup", () => {
|
10
|
-
expect(langJson.lookup("key", { key: "value" })).toBe("value");
|
11
|
-
});
|
12
|
-
test("Nested lookup", () => {
|
13
|
-
const data = { nested: { key: "value" } };
|
14
|
-
expect(langJson.lookup("nested.key", data)).toBe("value");
|
15
|
-
});
|
16
|
-
test("Non-existent key in lookup", () => {
|
17
|
-
expect(langJson.lookup("missingKey", { key: "value" })).toBe(undefined);
|
18
|
-
});
|
19
|
-
test("Lookup with array index access", () => {
|
20
|
-
const data = { items: ["first", "second", "third"] };
|
21
|
-
expect(langJson.lookup("items[1]", data)).toBe("second");
|
22
|
-
});
|
23
|
-
test("Lookup for deeply nested paths", () => {
|
24
|
-
const data = { a: { b: { c: { d: "deepValue" } } } };
|
25
|
-
expect(langJson.lookup("a.b.c.d", data)).toBe("deepValue");
|
26
|
-
});
|
27
|
-
test("Lookup with array and non-existent index", () => {
|
28
|
-
const data = { items: ["first", "second", "third"] };
|
29
|
-
expect(langJson.lookup("items[10]", data)).toBe(undefined);
|
30
|
-
});
|
31
|
-
test("Lookup with non-string keys", () => {
|
32
|
-
const data = { 1: "one", 2: "two" };
|
33
|
-
expect(langJson.lookup("1", data)).toBe("one");
|
34
|
-
});
|
35
|
-
test("Lookup with undefined or null values", () => {
|
36
|
-
const data = { key: null, anotherKey: undefined };
|
37
|
-
expect(langJson.lookup("key", data)).toBe(null);
|
38
|
-
expect(langJson.lookup("anotherKey", data)).toBe(undefined);
|
39
|
-
});
|
40
|
-
test("Lookup with nested key and array mix", () => {
|
41
|
-
const data = { items: [{ name: "first" }, { name: "second" }] };
|
42
|
-
expect(langJson.lookup("items[1].name", data)).toBe("second");
|
43
|
-
});
|
44
|
-
test("Lookup with complex keys containing spaces", () => {
|
45
|
-
const data = { "key with spaces": { "another key": "value" } };
|
46
|
-
expect(langJson.lookup("key with spaces.another key", data)).toBe("value");
|
47
|
-
});
|
48
|
-
test("Lookup with deeply nested array of objects", () => {
|
49
|
-
const data = {
|
50
|
-
level1: [{ level2: [{ level3: { key: "deepValue" } }] }],
|
51
|
-
};
|
52
|
-
expect(langJson.lookup("level1[0].level2[0].level3.key", data)).toBe("deepValue");
|
53
|
-
});
|
54
|
-
test("Lookup with special characters and symbols in the key", () => {
|
55
|
-
const data = { "key@#": "specialValue" };
|
56
|
-
expect(langJson.lookup("key@#", data)).toBe("specialValue");
|
57
|
-
});
|
58
|
-
test("Lookup with circular reference in data", () => {
|
59
|
-
const data = {};
|
60
|
-
data.self = data; // Circular reference
|
61
|
-
expect(langJson.lookup("self.self.self", data)).toBe(data);
|
62
|
-
});
|
63
|
-
test("Lookup with an empty string as key", () => {
|
64
|
-
const data = { "": "emptyKey" };
|
65
|
-
expect(langJson.lookup("", data)).toBe("emptyKey");
|
66
|
-
});
|
67
|
-
test("Lookup with mixed object and array access in key", () => {
|
68
|
-
const data = {
|
69
|
-
list: [{ nested: { key: "arrayObjectValue" } }],
|
70
|
-
};
|
71
|
-
expect(langJson.lookup("list[0].nested.key", data)).toBe("arrayObjectValue");
|
72
|
-
});
|
73
|
-
/**
|
74
|
-
* -------------------------
|
75
|
-
* Test: processHelper method
|
76
|
-
* -------------------------
|
77
|
-
*/
|
78
|
-
test("processHelper with zero arguments", () => {
|
79
|
-
langJson.registerHelper("returnHello", () => "Hello");
|
80
|
-
expect(langJson.processHelper("{{#returnHello}}", { key: "value" })).toBe("Hello");
|
81
|
-
});
|
82
|
-
test("processHelper with valid var key", () => {
|
83
|
-
expect(langJson.processHelper("{{#var key}}", { key: "value" })).toBe("value");
|
84
|
-
});
|
85
|
-
test("processHelper with missing key in data", () => {
|
86
|
-
expect(langJson.processHelper("{{#var missingKey}}", { key: "value" })).toBe(undefined);
|
87
|
-
});
|
88
|
-
test("processHelper with missing helper", () => {
|
89
|
-
expect(() => {
|
90
|
-
langJson.processHelper("{{#unknown key}}", { key: "value" });
|
91
|
-
}).toThrow("Missing helper : unknown"); // Or you can specify the error message with toThrow("error message")
|
92
|
-
});
|
93
|
-
test("processHelper with nested helper call", () => {
|
94
|
-
expect(langJson.processHelper("{{#var (var key)}}", {
|
95
|
-
key: "nestedKey",
|
96
|
-
nestedKey: "result",
|
97
|
-
})).toBe("result");
|
98
|
-
});
|
99
|
-
test("processHelper with escaped variable", () => {
|
100
|
-
expect(langJson.processHelper("This is {{#var key}}!", { key: "value" })).toBe("This is value!");
|
101
|
-
});
|
102
|
-
test("processHelper with escaping inside helper", () => {
|
103
|
-
expect(langJson.processHelper("{{#var key}} is {{#var anotherKey}}", {
|
104
|
-
key: "value",
|
105
|
-
anotherKey: "escapedValue",
|
106
|
-
})).toBe("value is escapedValue");
|
107
|
-
});
|
108
|
-
test("processHelper with boolean handling", () => {
|
109
|
-
const data = { isTrue: true, isFalse: false };
|
110
|
-
expect(langJson.processHelper("{{#var isTrue}}", data)).toBe(true);
|
111
|
-
expect(langJson.processHelper("{{#var isFalse}}", data)).toBe(false);
|
112
|
-
});
|
113
|
-
test("processHelper with multiple variables in one template", () => {
|
114
|
-
const template = "Hello, {{#var firstName}} {{#var lastName}}!";
|
115
|
-
const data = { firstName: "John", lastName: "Doe" };
|
116
|
-
expect(langJson.processHelper(template, data)).toBe("Hello, John Doe!");
|
117
|
-
});
|
118
|
-
test("processHelper with nested variable in object", () => {
|
119
|
-
const template = "{{#var user.details.name}}";
|
120
|
-
const data = { user: { details: { name: "Jane" } } };
|
121
|
-
expect(langJson.processHelper(template, data)).toBe("Jane");
|
122
|
-
});
|
123
|
-
test("processHelper with array passed as argument", () => {
|
124
|
-
langJson.registerHelper("join", ([arr]) => arr.join(", "));
|
125
|
-
expect(langJson.processHelper("{{#join items}}", {
|
126
|
-
items: ["apple", "banana", "cherry"],
|
127
|
-
})).toBe("apple, banana, cherry");
|
128
|
-
});
|
129
|
-
// test("processHelper with complex nesting of helpers", () => {
|
130
|
-
// langJson.registerHelper("outer", ([arg]) => `outer(${arg})`);
|
131
|
-
// langJson.registerHelper("inner", ([arg]) => `inner(${arg})`);
|
132
|
-
// expect(
|
133
|
-
// langJson.processHelper("{{#outer (inner key)}}", { key: "value" })
|
134
|
-
// ).toBe("outer(inner(value))");
|
135
|
-
// });
|
136
|
-
test("processHelper with variable inside a helper argument", () => {
|
137
|
-
langJson.registerHelper("wrap", (arg) => `[${arg}]`);
|
138
|
-
expect(langJson.processHelper("{{#wrap (var key)}}", { key: "content" })).toBe("[content]");
|
139
|
-
});
|
140
|
-
// test("processHelper with escaped special characters", () => {
|
141
|
-
// expect(
|
142
|
-
// langJson.processHelper("Use \\{{#var key}} to access value", {
|
143
|
-
// key: "data",
|
144
|
-
// })
|
145
|
-
// ).toBe("Use {{#var key}} to access value");
|
146
|
-
// });
|
147
|
-
test("processHelper with an empty helper name", () => {
|
148
|
-
expect(langJson.processHelper("{{# key}}", { key: "value" })).toBe("{{# key}}");
|
149
|
-
});
|
150
|
-
test("processHelper with incorrect data types for variables", () => {
|
151
|
-
expect(langJson.processHelper("{{#var key}}", { key: 123 })).toBe(123);
|
152
|
-
expect(langJson.processHelper("{{#var key}}", { key: true })).toBe(true);
|
153
|
-
expect(langJson.processHelper("{{#var key}}", { key: null })).toBe(null);
|
154
|
-
});
|
155
|
-
test("processHelper with non-terminating helper expressions", () => {
|
156
|
-
expect(langJson.processHelper("{{#var key", { key: "value" })).toBe("{{#var key");
|
157
|
-
});
|
158
|
-
test("processHelper with special characters in variable names", () => {
|
159
|
-
const data = {
|
160
|
-
"key-with-dash": "valueWithDash",
|
161
|
-
"key@symbol": "valueWithSymbol",
|
162
|
-
};
|
163
|
-
expect(langJson.processHelper("{{#var key-with-dash}}", data)).toBe("valueWithDash");
|
164
|
-
expect(langJson.processHelper("{{#var key@symbol}}", data)).toBe("valueWithSymbol");
|
165
|
-
});
|
166
|
-
test("processHelper with helper functions throwing errors", () => {
|
167
|
-
langJson.registerHelper("errorHelper", () => {
|
168
|
-
throw new Error("Helper error");
|
169
|
-
});
|
170
|
-
expect(() => langJson.processHelper("{{#errorHelper}}", {})).toThrow("Helper error");
|
171
|
-
});
|
172
|
-
/**
|
173
|
-
* -------------------------
|
174
|
-
* Test: applyTemplate method
|
175
|
-
* -------------------------
|
176
|
-
*/
|
177
|
-
test("applyTemplate with object template", () => {
|
178
|
-
const template = { "{{#var firstName}}": "{{#var lastName}}" };
|
179
|
-
const data = { firstName: "John", lastName: "Doe" };
|
180
|
-
expect(langJson.applyTemplate(template, data)).toEqual({ John: "Doe" });
|
181
|
-
});
|
182
|
-
test("applyTemplate with array of strings", () => {
|
183
|
-
const template = ["{{#var key}}", "{{#var value}}"];
|
184
|
-
const data = { key: "first", value: "second" };
|
185
|
-
expect(langJson.applyTemplate(template, data)).toEqual(["first", "second"]);
|
186
|
-
});
|
187
|
-
test("applyTemplate with nested objects", () => {
|
188
|
-
const template = {
|
189
|
-
"{{#var user.name}}": { age: "{{#var user.age}}" },
|
190
|
-
};
|
191
|
-
const data = { user: { name: "Alice", age: 30 } };
|
192
|
-
expect(langJson.applyTemplate(template, data)).toEqual({
|
193
|
-
Alice: { age: 30 },
|
194
|
-
});
|
195
|
-
});
|
196
|
-
test("applyTemplate with array of objects", () => {
|
197
|
-
const template = [
|
198
|
-
{ "{{#var firstName}}": "{{#var lastName}}" },
|
199
|
-
{ "{{#var firstName}}": "{{#var age}}" },
|
200
|
-
];
|
201
|
-
const data = { firstName: "John", lastName: "Doe", age: 30 };
|
202
|
-
expect(langJson.applyTemplate(template, data)).toEqual([
|
203
|
-
{ John: "Doe" },
|
204
|
-
{ John: 30 },
|
205
|
-
]);
|
206
|
-
});
|
207
|
-
test("applyTemplate with boolean values", () => {
|
208
|
-
const template = { "{{#var isActive}}": "Active" };
|
209
|
-
const data = { isActive: true };
|
210
|
-
expect(langJson.applyTemplate(template, data)).toEqual({ true: "Active" });
|
211
|
-
});
|
212
|
-
test("applyTemplate with deeply nested object structures", () => {
|
213
|
-
const template = {
|
214
|
-
"{{#var user.name}}": {
|
215
|
-
"{{#var user.details.age}}": "{{#var user.details.address}}",
|
216
|
-
},
|
217
|
-
};
|
218
|
-
const data = {
|
219
|
-
user: { name: "John", details: { age: 30, address: "NY" } },
|
220
|
-
};
|
221
|
-
expect(langJson.applyTemplate(template, data)).toEqual({
|
222
|
-
John: { 30: "NY" },
|
223
|
-
});
|
224
|
-
});
|
225
|
-
test("applyTemplate with mixed arrays and objects", () => {
|
226
|
-
const template = [
|
227
|
-
{ "{{#var firstName}}": "{{#var lastName}}" },
|
228
|
-
"{{#var age}}",
|
229
|
-
["{{#var city}}", "{{#var country}}"],
|
230
|
-
];
|
231
|
-
const data = {
|
232
|
-
firstName: "John",
|
233
|
-
lastName: "Doe",
|
234
|
-
age: 30,
|
235
|
-
city: "New York",
|
236
|
-
country: "USA",
|
237
|
-
};
|
238
|
-
expect(langJson.applyTemplate(template, data)).toEqual([
|
239
|
-
{ John: "Doe" },
|
240
|
-
30,
|
241
|
-
["New York", "USA"],
|
242
|
-
]);
|
243
|
-
});
|
244
|
-
test("applyTemplate with missing keys in template", () => {
|
245
|
-
const template = { "{{#var firstName}}": "{{#var lastName}}" };
|
246
|
-
const data = { firstName: "John" }; // missing lastName
|
247
|
-
expect(langJson.applyTemplate(template, data)).toEqual({
|
248
|
-
John: undefined,
|
249
|
-
});
|
250
|
-
});
|
251
|
-
test("applyTemplate with escaping in template", () => {
|
252
|
-
const template = { escapedVar: "{{#var key}}" };
|
253
|
-
const data = { key: "value" };
|
254
|
-
expect(langJson.applyTemplate(template, data)).toEqual({
|
255
|
-
escapedVar: "value",
|
256
|
-
});
|
257
|
-
});
|
258
|
-
test("applyTemplate with undefined data values", () => {
|
259
|
-
const template = { "{{#var key}}": "value" };
|
260
|
-
const data = { key: undefined };
|
261
|
-
expect(langJson.applyTemplate(template, data)).toEqual({
|
262
|
-
undefined: "value",
|
263
|
-
});
|
264
|
-
});
|
265
|
-
test("applyTemplate with conditional logic in templates", () => {
|
266
|
-
langJson.registerHelper("ifEquals", ([a, b]) => (a === b ? "Yes" : "No"));
|
267
|
-
const template = { "{{#ifEquals user.role 'admin'}}": "Is Admin" };
|
268
|
-
expect(langJson.applyTemplate(template, { user: { role: "admin" } })).toEqual({
|
269
|
-
Yes: "Is Admin",
|
270
|
-
});
|
271
|
-
expect(langJson.applyTemplate(template, { user: { role: "user" } })).toEqual({
|
272
|
-
No: "Is Admin",
|
273
|
-
});
|
274
|
-
});
|
275
|
-
test("applyTemplate with circular references in data", () => {
|
276
|
-
const data = { key: "value" };
|
277
|
-
data.self = data; // Create circular reference
|
278
|
-
const template = { "{{#var key}}": "{{#var self.key}}" };
|
279
|
-
expect(langJson.applyTemplate(template, data)).toEqual({ value: "value" });
|
280
|
-
});
|
281
|
-
test("applyTemplate with keys that are numbers", () => {
|
282
|
-
const template = { "{{#var 1}}": "{{#var 2}}" };
|
283
|
-
const data = { 1: "one", 2: "two" };
|
284
|
-
expect(langJson.applyTemplate(template, data)).toEqual({ one: "two" });
|
285
|
-
});
|
286
|
-
test("applyTemplate with deeply nested structures and template resolution", () => {
|
287
|
-
const template = {
|
288
|
-
"{{#var user.name}}": {
|
289
|
-
"{{#var user.job.title}}": {
|
290
|
-
"{{#var user.job.department}}": "{{#var user.job.level}}",
|
291
|
-
},
|
292
|
-
},
|
293
|
-
};
|
294
|
-
const data = {
|
295
|
-
user: {
|
296
|
-
name: "John",
|
297
|
-
job: {
|
298
|
-
title: "Manager",
|
299
|
-
department: "Sales",
|
300
|
-
level: "Senior",
|
301
|
-
},
|
302
|
-
},
|
303
|
-
};
|
304
|
-
expect(langJson.applyTemplate(template, data)).toEqual({
|
305
|
-
John: { Manager: { Sales: "Senior" } },
|
306
|
-
});
|
307
|
-
});
|
308
|
-
/**
|
309
|
-
* -------------------------
|
310
|
-
* Test: Registering custom helper functions
|
311
|
-
* -------------------------
|
312
|
-
*/
|
313
|
-
test("registerHelper with custom helper", () => {
|
314
|
-
langJson.registerHelper("custom", ([arg]) => arg.toUpperCase());
|
315
|
-
expect(langJson.processHelper("{{#custom key}}", { key: "value" })).toBe("VALUE");
|
316
|
-
});
|
317
|
-
test("registerHelpers with multiple custom helpers", () => {
|
318
|
-
langJson.registerHelpers({
|
319
|
-
upper: ([arg]) => arg.toUpperCase(),
|
320
|
-
lower: ([arg]) => arg.toLowerCase(),
|
321
|
-
});
|
322
|
-
expect(langJson.processHelper("{{#upper key}}", { key: "Value" })).toBe("VALUE");
|
323
|
-
expect(langJson.processHelper("{{#lower key}}", { key: "VALUE" })).toBe("value");
|
324
|
-
});
|
325
|
-
test("registerHelper with no arguments", () => {
|
326
|
-
langJson.registerHelper("noArgs", () => "No Args!");
|
327
|
-
expect(langJson.processHelper("{{#noArgs}}", {})).toBe("No Args!");
|
328
|
-
});
|
329
|
-
test("registerHelper with multiple arguments", () => {
|
330
|
-
langJson.registerHelper("concat", ([arg1, arg2]) => arg1 + arg2);
|
331
|
-
expect(langJson.processHelper("{{#concat first second}}", {
|
332
|
-
first: "Hello",
|
333
|
-
second: "World",
|
334
|
-
})).toBe("HelloWorld");
|
335
|
-
});
|
336
|
-
test("registerHelper for formatting or computation", () => {
|
337
|
-
langJson.registerHelper("add", ([a, b]) => a + b);
|
338
|
-
expect(langJson.processHelper("{{#add 5 10}}", {})).toBe(15);
|
339
|
-
});
|
340
|
-
test("registerHelper with string manipulation", () => {
|
341
|
-
langJson.registerHelper("reverse", ([arg]) => arg.split("").reverse().join(""));
|
342
|
-
expect(langJson.processHelper("{{#reverse word}}", { word: "hello" })).toBe("olleh");
|
343
|
-
});
|
344
|
-
});
|
345
|
-
test("registerHelper for conditional formatting", () => {
|
346
|
-
langJson.registerHelper("isAdult", ([age]) => age >= 18 ? "Adult" : "Minor");
|
347
|
-
expect(langJson.processHelper("{{#isAdult age}}", { age: 20 })).toBe("Adult");
|
348
|
-
expect(langJson.processHelper("{{#isAdult age}}", { age: 15 })).toBe("Minor");
|
349
|
-
});
|
350
|
-
test("registerHelper with arguments having special characters", () => {
|
351
|
-
langJson.registerHelper("sanitize", ([str]) => str.replace(/[^a-zA-Z ]/g, ""));
|
352
|
-
expect(langJson.processHelper("{{#sanitize key}}", { key: "Hello@World!" })).toBe("HelloWorld");
|
353
|
-
});
|
354
|
-
test("registerHelper for handling empty input", () => {
|
355
|
-
langJson.registerHelper("isEmpty", ([str]) => str === "" ? "Empty" : "Not Empty");
|
356
|
-
expect(langJson.processHelper("{{#isEmpty key}}", { key: "" })).toBe("Empty");
|
357
|
-
expect(langJson.processHelper("{{#isEmpty key}}", { key: "Value" })).toBe("Not Empty");
|
358
|
-
});
|
359
|
-
test("registerHelper that throws an error", () => {
|
360
|
-
langJson.registerHelper("throwError", () => {
|
361
|
-
throw new Error("Something went wrong!");
|
362
|
-
});
|
363
|
-
expect(() => langJson.processHelper("{{#throwError}}", {})).toThrow("Something went wrong!");
|
364
|
-
});
|
365
|
-
test("registerHelper with default values for missing arguments", () => {
|
366
|
-
langJson.registerHelper("defaultArg", ([arg = "default"]) => arg);
|
367
|
-
expect(langJson.processHelper("{{#defaultArg}}", {})).toBe("default");
|
368
|
-
expect(langJson.processHelper("{{#defaultArg key}}", { key: "provided" })).toBe("provided");
|
369
|
-
});
|
370
|
-
test("registerHelper with multiple arguments passed dynamically", () => {
|
371
|
-
langJson.registerHelper("concat", ([...args]) => args.join("-"));
|
372
|
-
expect(langJson.processHelper("{{#concat key1 key2 key3}}", {
|
373
|
-
key1: "first",
|
374
|
-
key2: "second",
|
375
|
-
key3: "third",
|
376
|
-
})).toBe("first-second-third");
|
377
|
-
});
|
378
|
-
test("registerHelper that returns an object instead of a string", () => {
|
379
|
-
langJson.registerHelper("createUser", ([name, age]) => ({ name, age }));
|
380
|
-
expect(langJson.processHelper("{{#createUser name age}}", {
|
381
|
-
name: "Alice",
|
382
|
-
age: 30,
|
383
|
-
})).toEqual({
|
384
|
-
name: "Alice",
|
385
|
-
age: 30,
|
386
|
-
});
|
387
|
-
});
|
388
|
-
// test("registerHelper with asynchronous operation (promise)", async () => {
|
389
|
-
// langJson.registerHelper("fetchData", async () => {
|
390
|
-
// return new Promise((resolve) => setTimeout(() => resolve("data"), 100));
|
391
|
-
// });
|
392
|
-
// const result = await langJson.processHelper("{{#fetchData}}", {});
|
393
|
-
// expect(result).toBe("data");
|
394
|
-
// });
|
395
|
-
test("registerHelper with fallback value if input is missing", () => {
|
396
|
-
langJson.registerHelper("default", ([value, fallback]) => value || fallback);
|
397
|
-
expect(langJson.processHelper("{{#default key 'defaultValue'}}", { key: null })).toBe("defaultValue");
|
398
|
-
});
|
399
|
-
test("registerHelper with helpers that modify objects", () => {
|
400
|
-
langJson.registerHelper("addProperty", ([obj, key, value]) => {
|
401
|
-
obj[key] = value;
|
402
|
-
return obj;
|
403
|
-
});
|
404
|
-
expect(langJson.processHelper("{{#addProperty obj key value}}", {
|
405
|
-
obj: {},
|
406
|
-
key: "newKey",
|
407
|
-
value: "newValue",
|
408
|
-
})).toEqual({
|
409
|
-
newKey: "newValue",
|
410
|
-
});
|
411
|
-
});
|
412
|
-
test("registerHelper that uses an internal state", () => {
|
413
|
-
let state = 0;
|
414
|
-
langJson.registerHelper("increment", () => {
|
415
|
-
state += 1;
|
416
|
-
return state;
|
417
|
-
});
|
418
|
-
expect(langJson.processHelper("{{#increment}}", {})).toBe(1);
|
419
|
-
expect(langJson.processHelper("{{#increment}}", {})).toBe(2);
|
420
|
-
expect(langJson.processHelper("{{#increment}}", {})).toBe(3);
|
421
|
-
});
|
422
|
-
test("registerHelper for formatting dates", () => {
|
423
|
-
langJson.registerHelper("formatDate", ([date, format]) => {
|
424
|
-
const d = new Date(date);
|
425
|
-
return `${d.getFullYear()}-${(d.getMonth() + 1)
|
426
|
-
.toString()
|
427
|
-
.padStart(2, "0")}-${d.getDate().toString().padStart(2, "0")}`;
|
428
|
-
});
|
429
|
-
expect(langJson.processHelper("{{#formatDate date 'YYYY-MM-DD'}}", {
|
430
|
-
date: "2023-01-01",
|
431
|
-
})).toBe("2023-01-01");
|
432
|
-
});
|
433
|
-
test("registerHelper that accepts multiple arguments and returns an object", () => {
|
434
|
-
langJson.registerHelper("createUser", ([name, age, role]) => ({
|
435
|
-
name,
|
436
|
-
age,
|
437
|
-
role,
|
438
|
-
}));
|
439
|
-
expect(langJson.processHelper("{{#createUser name age role}}", {
|
440
|
-
name: "Alice",
|
441
|
-
age: 30,
|
442
|
-
role: "Engineer",
|
443
|
-
})).toEqual({
|
444
|
-
name: "Alice",
|
445
|
-
age: 30,
|
446
|
-
role: "Engineer",
|
447
|
-
});
|
448
|
-
});
|
449
|
-
test("Complex integration test for LangJSON functionality", () => {
|
450
|
-
// Register multiple helpers
|
451
|
-
langJson.registerHelpers({
|
452
|
-
upper: ([str]) => str.toUpperCase(),
|
453
|
-
lower: ([str]) => str.toLowerCase(),
|
454
|
-
concat: ([arg1, arg2]) => `${arg1} ${arg2}`,
|
455
|
-
isTrue: ([arg]) => arg === "true",
|
456
|
-
getLength: ([arr]) => arr.length,
|
457
|
-
repeat: ([str, times]) => str.repeat(times),
|
458
|
-
});
|
459
|
-
// Define a complex data structure
|
460
|
-
const data = {
|
461
|
-
user: {
|
462
|
-
name: "Alice",
|
463
|
-
age: 30,
|
464
|
-
roles: ["admin", "editor"],
|
465
|
-
address: {
|
466
|
-
city: "Wonderland",
|
467
|
-
zip: "12345",
|
468
|
-
coordinates: { lat: 51.5074, long: -0.1278 },
|
469
|
-
},
|
470
|
-
preferences: {
|
471
|
-
notifications: { email: true, sms: false },
|
472
|
-
theme: "dark",
|
473
|
-
},
|
474
|
-
},
|
475
|
-
isActive: "true",
|
476
|
-
items: [
|
477
|
-
{ id: 1, name: "Item1", description: "First Item" },
|
478
|
-
{ id: 2, name: "Item2", description: "Second Item" },
|
479
|
-
{ id: 3, name: "Item3", description: "Third Item" },
|
480
|
-
],
|
481
|
-
};
|
482
|
-
// Define a complex template
|
483
|
-
const template = {
|
484
|
-
"{{#upper user.name}}": {
|
485
|
-
age: "{{#var user.age}}",
|
486
|
-
active: "{{#isTrue isActive}}",
|
487
|
-
address: {
|
488
|
-
city: "{{#var user.address.city}}",
|
489
|
-
zip: "{{#var user.address.zip}}",
|
490
|
-
coordinates: "{{#var user.address.coordinates.lat}}, {{#var user.address.coordinates.long}}",
|
491
|
-
},
|
492
|
-
roles: {
|
493
|
-
"{{#arrayJoin (var user.roles) ', '}}": {
|
494
|
-
roleCount: "{{#getLength user.roles}}",
|
495
|
-
roleList: "{{#var user.roles[0]}} and {{#var user.roles[1]}}",
|
496
|
-
},
|
497
|
-
},
|
498
|
-
items: "{{#repeat (concat 'Item: ' (var items[0].name)) 3}}",
|
499
|
-
preferences: {
|
500
|
-
theme: "{{#var user.preferences.theme}}",
|
501
|
-
notificationStatus: {
|
502
|
-
email: "{{#var user.preferences.notifications.email}}",
|
503
|
-
sms: "{{#var user.preferences.notifications.sms}}",
|
504
|
-
},
|
505
|
-
},
|
506
|
-
},
|
507
|
-
};
|
508
|
-
// Apply the template with the complex data
|
509
|
-
const result = langJson.applyTemplate(template, data);
|
510
|
-
// Validate the output
|
511
|
-
expect(result).toEqual({
|
512
|
-
ALICE: {
|
513
|
-
age: 30,
|
514
|
-
active: true,
|
515
|
-
address: {
|
516
|
-
city: "Wonderland",
|
517
|
-
zip: "12345",
|
518
|
-
coordinates: "51.5074, -0.1278",
|
519
|
-
},
|
520
|
-
roles: {
|
521
|
-
"admin, editor": {
|
522
|
-
roleCount: 2,
|
523
|
-
roleList: "admin and editor",
|
524
|
-
},
|
525
|
-
},
|
526
|
-
items: "Item: Item1Item: Item1Item: Item1",
|
527
|
-
preferences: {
|
528
|
-
theme: "dark",
|
529
|
-
notificationStatus: {
|
530
|
-
email: true,
|
531
|
-
sms: false,
|
532
|
-
},
|
533
|
-
},
|
534
|
-
},
|
535
|
-
});
|
536
|
-
});
|
537
|
-
//# sourceMappingURL=index.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../tests/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,cAAc,CAAC;AAEpC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC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;aAClF;YACD,KAAK,EAAE;gBACL,sCAAsC,EAAE;oBACtC,SAAS,EAAE,2BAA2B;oBACtC,QAAQ,EAAE,mDAAmD;iBAC9D;aACF;YACD,KAAK,EAAE,qDAAqD;YAC5D,WAAW,EAAE;gBACX,KAAK,EAAE,iCAAiC;gBACxC,kBAAkB,EAAE;oBAClB,KAAK,EAAE,+CAA+C;oBACtD,GAAG,EAAE,6CAA6C;iBACnD;aACF;SACF;KACF,CAAC;IAEF,2CAA2C;IAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAEtD,sBAAsB;IACtB,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;QACrB,KAAK,EAAE;YACL,GAAG,EAAE,EAAE;YACP,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,YAAY;gBAClB,GAAG,EAAE,OAAO;gBACZ,WAAW,EAAE,kBAAkB;aAChC;YACD,KAAK,EAAE;gBACL,eAAe,EAAE;oBACf,SAAS,EAAE,CAAC;oBACZ,QAAQ,EAAE,kBAAkB;iBAC7B;aACF;YACD,KAAK,EAAE,sCAAsC;YAC7C,WAAW,EAAE;gBACX,KAAK,EAAE,MAAM;gBACb,kBAAkB,EAAE;oBAClB,KAAK,EAAE,IAAI;oBACX,GAAG,EAAE,KAAK;iBACX;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import LangJSON from "../src/index";
|
2
|
-
// Create an instance of LangJSON
|
3
|
-
const langJSON = new LangJSON();
|
4
|
-
describe("LangJSON Templating Tests", () => {
|
5
|
-
test("String Manipulation - Uppercase", () => {
|
6
|
-
const template = {
|
7
|
-
greeting: "{{#uppercase 'hello'}} world",
|
8
|
-
};
|
9
|
-
const data = {};
|
10
|
-
const result = langJSON.applyTemplate(template, data);
|
11
|
-
expect(result).toEqual({ greeting: "HELLO world" });
|
12
|
-
});
|
13
|
-
test("Conditional Statements - Active Status", () => {
|
14
|
-
const template = {
|
15
|
-
status: "{{#if isActive 'Active' 'Inactive'}}",
|
16
|
-
};
|
17
|
-
const data = { isActive: true };
|
18
|
-
const result = langJSON.applyTemplate(template, data);
|
19
|
-
expect(result).toEqual({ status: "Active" });
|
20
|
-
});
|
21
|
-
test("Looping Through Arrays - Users List", () => {
|
22
|
-
const template = {
|
23
|
-
users: {
|
24
|
-
"{{#each users}}": {
|
25
|
-
name: "{{#var item.name}}",
|
26
|
-
age: "{{#var item.age}}",
|
27
|
-
},
|
28
|
-
},
|
29
|
-
};
|
30
|
-
const data = {
|
31
|
-
users: [
|
32
|
-
{ name: "John", age: 30 },
|
33
|
-
{ name: "Jane", age: 25 },
|
34
|
-
{ name: "Doe", age: 40 },
|
35
|
-
],
|
36
|
-
};
|
37
|
-
const result = langJSON.applyTemplate(template, data);
|
38
|
-
expect(result).toEqual({
|
39
|
-
users: [
|
40
|
-
{ name: "John", age: 30 },
|
41
|
-
{ name: "Jane", age: 25 },
|
42
|
-
{ name: "Doe", age: 40 },
|
43
|
-
],
|
44
|
-
});
|
45
|
-
});
|
46
|
-
test("Chaining Helpers - Concatenation and Uppercase", () => {
|
47
|
-
const template = {
|
48
|
-
message: "{{#uppercase (concat 'hello' ', world')}}",
|
49
|
-
};
|
50
|
-
const data = {};
|
51
|
-
const result = langJSON.applyTemplate(template, data);
|
52
|
-
expect(result).toEqual({ message: "HELLO, WORLD" });
|
53
|
-
});
|
54
|
-
test("Performance Tips - Large Data", () => {
|
55
|
-
const largeData = {
|
56
|
-
users: Array.from({ length: 1000 }, (_, index) => ({
|
57
|
-
name: `User${index + 1}`,
|
58
|
-
age: 20 + (index % 50),
|
59
|
-
})),
|
60
|
-
};
|
61
|
-
const template = {
|
62
|
-
users: {
|
63
|
-
"{{#each users}}": {
|
64
|
-
name: "{{#var item.name}}",
|
65
|
-
age: "{{#var item.age}}",
|
66
|
-
},
|
67
|
-
},
|
68
|
-
};
|
69
|
-
const result = langJSON.applyTemplate(template, largeData);
|
70
|
-
expect(result.users.length).toBe(1000);
|
71
|
-
});
|
72
|
-
});
|
73
|
-
//# sourceMappingURL=readme.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"readme.test.js","sourceRoot":"","sources":["../../../tests/readme.test.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,cAAc,CAAC;AAEpC,iCAAiC;AACjC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;AAEhC,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC3C,MAAM,QAAQ,GAAG;YACf,QAAQ,EAAE,8BAA8B;SACzC,CAAC;QACF,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAClD,MAAM,QAAQ,GAAG;YACf,MAAM,EAAE,sCAAsC;SAC/C,CAAC;QACF,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC/C,MAAM,QAAQ,GAAG;YACf,KAAK,EAAE;gBACL,iBAAiB,EAAE;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