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,196 +0,0 @@
|
|
1
|
-
/* eslint-disable */
|
2
|
-
var addSorting = (function() {
|
3
|
-
'use strict';
|
4
|
-
var cols,
|
5
|
-
currentSort = {
|
6
|
-
index: 0,
|
7
|
-
desc: false
|
8
|
-
};
|
9
|
-
|
10
|
-
// returns the summary table element
|
11
|
-
function getTable() {
|
12
|
-
return document.querySelector('.coverage-summary');
|
13
|
-
}
|
14
|
-
// returns the thead element of the summary table
|
15
|
-
function getTableHeader() {
|
16
|
-
return getTable().querySelector('thead tr');
|
17
|
-
}
|
18
|
-
// returns the tbody element of the summary table
|
19
|
-
function getTableBody() {
|
20
|
-
return getTable().querySelector('tbody');
|
21
|
-
}
|
22
|
-
// returns the th element for nth column
|
23
|
-
function getNthColumn(n) {
|
24
|
-
return getTableHeader().querySelectorAll('th')[n];
|
25
|
-
}
|
26
|
-
|
27
|
-
function onFilterInput() {
|
28
|
-
const searchValue = document.getElementById('fileSearch').value;
|
29
|
-
const rows = document.getElementsByTagName('tbody')[0].children;
|
30
|
-
for (let i = 0; i < rows.length; i++) {
|
31
|
-
const row = rows[i];
|
32
|
-
if (
|
33
|
-
row.textContent
|
34
|
-
.toLowerCase()
|
35
|
-
.includes(searchValue.toLowerCase())
|
36
|
-
) {
|
37
|
-
row.style.display = '';
|
38
|
-
} else {
|
39
|
-
row.style.display = 'none';
|
40
|
-
}
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
// loads the search box
|
45
|
-
function addSearchBox() {
|
46
|
-
var template = document.getElementById('filterTemplate');
|
47
|
-
var templateClone = template.content.cloneNode(true);
|
48
|
-
templateClone.getElementById('fileSearch').oninput = onFilterInput;
|
49
|
-
template.parentElement.appendChild(templateClone);
|
50
|
-
}
|
51
|
-
|
52
|
-
// loads all columns
|
53
|
-
function loadColumns() {
|
54
|
-
var colNodes = getTableHeader().querySelectorAll('th'),
|
55
|
-
colNode,
|
56
|
-
cols = [],
|
57
|
-
col,
|
58
|
-
i;
|
59
|
-
|
60
|
-
for (i = 0; i < colNodes.length; i += 1) {
|
61
|
-
colNode = colNodes[i];
|
62
|
-
col = {
|
63
|
-
key: colNode.getAttribute('data-col'),
|
64
|
-
sortable: !colNode.getAttribute('data-nosort'),
|
65
|
-
type: colNode.getAttribute('data-type') || 'string'
|
66
|
-
};
|
67
|
-
cols.push(col);
|
68
|
-
if (col.sortable) {
|
69
|
-
col.defaultDescSort = col.type === 'number';
|
70
|
-
colNode.innerHTML =
|
71
|
-
colNode.innerHTML + '<span class="sorter"></span>';
|
72
|
-
}
|
73
|
-
}
|
74
|
-
return cols;
|
75
|
-
}
|
76
|
-
// attaches a data attribute to every tr element with an object
|
77
|
-
// of data values keyed by column name
|
78
|
-
function loadRowData(tableRow) {
|
79
|
-
var tableCols = tableRow.querySelectorAll('td'),
|
80
|
-
colNode,
|
81
|
-
col,
|
82
|
-
data = {},
|
83
|
-
i,
|
84
|
-
val;
|
85
|
-
for (i = 0; i < tableCols.length; i += 1) {
|
86
|
-
colNode = tableCols[i];
|
87
|
-
col = cols[i];
|
88
|
-
val = colNode.getAttribute('data-value');
|
89
|
-
if (col.type === 'number') {
|
90
|
-
val = Number(val);
|
91
|
-
}
|
92
|
-
data[col.key] = val;
|
93
|
-
}
|
94
|
-
return data;
|
95
|
-
}
|
96
|
-
// loads all row data
|
97
|
-
function loadData() {
|
98
|
-
var rows = getTableBody().querySelectorAll('tr'),
|
99
|
-
i;
|
100
|
-
|
101
|
-
for (i = 0; i < rows.length; i += 1) {
|
102
|
-
rows[i].data = loadRowData(rows[i]);
|
103
|
-
}
|
104
|
-
}
|
105
|
-
// sorts the table using the data for the ith column
|
106
|
-
function sortByIndex(index, desc) {
|
107
|
-
var key = cols[index].key,
|
108
|
-
sorter = function(a, b) {
|
109
|
-
a = a.data[key];
|
110
|
-
b = b.data[key];
|
111
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
112
|
-
},
|
113
|
-
finalSorter = sorter,
|
114
|
-
tableBody = document.querySelector('.coverage-summary tbody'),
|
115
|
-
rowNodes = tableBody.querySelectorAll('tr'),
|
116
|
-
rows = [],
|
117
|
-
i;
|
118
|
-
|
119
|
-
if (desc) {
|
120
|
-
finalSorter = function(a, b) {
|
121
|
-
return -1 * sorter(a, b);
|
122
|
-
};
|
123
|
-
}
|
124
|
-
|
125
|
-
for (i = 0; i < rowNodes.length; i += 1) {
|
126
|
-
rows.push(rowNodes[i]);
|
127
|
-
tableBody.removeChild(rowNodes[i]);
|
128
|
-
}
|
129
|
-
|
130
|
-
rows.sort(finalSorter);
|
131
|
-
|
132
|
-
for (i = 0; i < rows.length; i += 1) {
|
133
|
-
tableBody.appendChild(rows[i]);
|
134
|
-
}
|
135
|
-
}
|
136
|
-
// removes sort indicators for current column being sorted
|
137
|
-
function removeSortIndicators() {
|
138
|
-
var col = getNthColumn(currentSort.index),
|
139
|
-
cls = col.className;
|
140
|
-
|
141
|
-
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
142
|
-
col.className = cls;
|
143
|
-
}
|
144
|
-
// adds sort indicators for current column being sorted
|
145
|
-
function addSortIndicators() {
|
146
|
-
getNthColumn(currentSort.index).className += currentSort.desc
|
147
|
-
? ' sorted-desc'
|
148
|
-
: ' sorted';
|
149
|
-
}
|
150
|
-
// adds event listeners for all sorter widgets
|
151
|
-
function enableUI() {
|
152
|
-
var i,
|
153
|
-
el,
|
154
|
-
ithSorter = function ithSorter(i) {
|
155
|
-
var col = cols[i];
|
156
|
-
|
157
|
-
return function() {
|
158
|
-
var desc = col.defaultDescSort;
|
159
|
-
|
160
|
-
if (currentSort.index === i) {
|
161
|
-
desc = !currentSort.desc;
|
162
|
-
}
|
163
|
-
sortByIndex(i, desc);
|
164
|
-
removeSortIndicators();
|
165
|
-
currentSort.index = i;
|
166
|
-
currentSort.desc = desc;
|
167
|
-
addSortIndicators();
|
168
|
-
};
|
169
|
-
};
|
170
|
-
for (i = 0; i < cols.length; i += 1) {
|
171
|
-
if (cols[i].sortable) {
|
172
|
-
// add the click event handler on the th so users
|
173
|
-
// dont have to click on those tiny arrows
|
174
|
-
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
175
|
-
if (el.addEventListener) {
|
176
|
-
el.addEventListener('click', ithSorter(i));
|
177
|
-
} else {
|
178
|
-
el.attachEvent('onclick', ithSorter(i));
|
179
|
-
}
|
180
|
-
}
|
181
|
-
}
|
182
|
-
}
|
183
|
-
// adds sorting functionality to the UI
|
184
|
-
return function() {
|
185
|
-
if (!getTable()) {
|
186
|
-
return;
|
187
|
-
}
|
188
|
-
cols = loadColumns();
|
189
|
-
loadData();
|
190
|
-
addSearchBox();
|
191
|
-
addSortIndicators();
|
192
|
-
enableUI();
|
193
|
-
};
|
194
|
-
})();
|
195
|
-
|
196
|
-
window.addEventListener('load', addSorting);
|
package/coverage/lcov.info
DELETED
File without changes
|
package/dist/esm/src/index.d.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
type HelperFunction = (args: any, data: any, innerTemplate: any) => any;
|
2
|
-
export default class LangJSON {
|
3
|
-
helpers: Record<string, HelperFunction>;
|
4
|
-
private memory;
|
5
|
-
constructor();
|
6
|
-
registerHelper(name: string, fn: HelperFunction): void;
|
7
|
-
registerHelpers(helpers: {
|
8
|
-
[key: string]: HelperFunction;
|
9
|
-
}): void;
|
10
|
-
getHelper(name: string): HelperFunction | undefined;
|
11
|
-
applyTemplate(template: any, data: any, innerTemplate?: any): any;
|
12
|
-
lookup(varPath: string | number, data: any): any;
|
13
|
-
sanitizeArg(arg: any, helperName: any, data: any): any;
|
14
|
-
handleSpitStringArgs(stringArg: string): string[];
|
15
|
-
processHelperArgs(helperArgs: string, data: any, innerTemplate: any): any;
|
16
|
-
processHelper(string: string, data: any, innerTemplate?: any, stringMatches?: any): any;
|
17
|
-
}
|
18
|
-
export {};
|
package/dist/esm/src/index.js
DELETED
@@ -1,369 +0,0 @@
|
|
1
|
-
import isThis from "@devanshdeveloper/is-this";
|
2
|
-
class MemoryAddresses {
|
3
|
-
storage = {};
|
4
|
-
// Helper function to generate a random string key
|
5
|
-
generateKey(length = 4) {
|
6
|
-
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";
|
7
|
-
let key = "";
|
8
|
-
for (let i = 0; i < length; i++) {
|
9
|
-
key += chars.charAt(Math.floor(Math.random() * chars.length));
|
10
|
-
}
|
11
|
-
return key;
|
12
|
-
}
|
13
|
-
// Store data with a random key
|
14
|
-
storeData(data) {
|
15
|
-
const key = this.generateKey();
|
16
|
-
this.storage[key] = data;
|
17
|
-
return key;
|
18
|
-
}
|
19
|
-
getData(key) {
|
20
|
-
return this.storage[key] !== undefined ? this.storage[key] : null;
|
21
|
-
}
|
22
|
-
removeData(key) {
|
23
|
-
if (this.storage[key]) {
|
24
|
-
delete this.storage[key];
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
export default class LangJSON {
|
29
|
-
helpers = {};
|
30
|
-
memory = {};
|
31
|
-
constructor() {
|
32
|
-
// Registering Default Helpers
|
33
|
-
this.registerHelpers({
|
34
|
-
var: ([string], data) => {
|
35
|
-
return this.lookup(string, data);
|
36
|
-
},
|
37
|
-
// manupilating helpers
|
38
|
-
each: ([arr], data, innerTemplate) => {
|
39
|
-
const result = [];
|
40
|
-
for (let i = 0; i < arr.length; i++) {
|
41
|
-
const element = arr[i];
|
42
|
-
result.push(this.applyTemplate(innerTemplate, {
|
43
|
-
...data,
|
44
|
-
item: element,
|
45
|
-
index: i,
|
46
|
-
}));
|
47
|
-
}
|
48
|
-
return result;
|
49
|
-
},
|
50
|
-
loop: ([number], data, innerTemplate) => {
|
51
|
-
const result = [];
|
52
|
-
for (let i = 0; i < number; i++) {
|
53
|
-
result.push(this.applyTemplate(innerTemplate, {
|
54
|
-
...data,
|
55
|
-
index: i,
|
56
|
-
}));
|
57
|
-
}
|
58
|
-
return result;
|
59
|
-
},
|
60
|
-
// String Helpers
|
61
|
-
uppercase: ([str]) => str.toUpperCase(),
|
62
|
-
lowercase: ([str]) => str.toLowerCase(),
|
63
|
-
capitalize: ([str]) => str.charAt(0).toUpperCase() + str.slice(1),
|
64
|
-
trim: ([str]) => str.trim(),
|
65
|
-
substring: ([str, start, length]) => str.substring(start, start + length),
|
66
|
-
concat: ([...args]) => args.join(""),
|
67
|
-
replace: ([str, search, replacement]) => str.replace(new RegExp(search, "g"), replacement),
|
68
|
-
split: ([str, separator]) => str.split(separator),
|
69
|
-
join: ([arr, separator]) => arr.join(separator),
|
70
|
-
contains: ([str, substring]) => str.includes(substring),
|
71
|
-
length: ([str]) => str.length,
|
72
|
-
startsWith: ([str, prefix]) => str.startsWith(prefix),
|
73
|
-
endsWith: ([str, suffix]) => str.endsWith(suffix),
|
74
|
-
reverseString: ([str]) => str.split("").reverse().join(""),
|
75
|
-
isEmpty: ([str]) => !str || str.length === 0,
|
76
|
-
repeat: ([str, times]) => str.repeat(times),
|
77
|
-
// Mathematical Helpers
|
78
|
-
add: ([a, b]) => a + b,
|
79
|
-
subtract: ([a, b]) => a - b,
|
80
|
-
multiply: ([a, b]) => a * b,
|
81
|
-
divide: ([a, b]) => a / b,
|
82
|
-
modulo: ([a, b]) => a % b,
|
83
|
-
max: ([...args]) => Math.max(...args),
|
84
|
-
min: ([...args]) => Math.min(...args),
|
85
|
-
round: ([num]) => Math.round(num),
|
86
|
-
floor: ([num]) => Math.floor(num),
|
87
|
-
ceil: ([num]) => Math.ceil(num),
|
88
|
-
// Logical Helpers
|
89
|
-
if: ([condition, trueValue, falseValue]) => condition ? trueValue : falseValue,
|
90
|
-
and: ([...conditions]) => conditions.every(Boolean),
|
91
|
-
or: ([...conditions]) => conditions.some(Boolean),
|
92
|
-
not: ([condition]) => !condition,
|
93
|
-
// Date and Time Helpers
|
94
|
-
getCurrentDate: () => new Date().toISOString().split("T")[0],
|
95
|
-
getCurrentTime: () => new Date().toLocaleTimeString(),
|
96
|
-
// Array Helpers
|
97
|
-
arrayLength: ([arr]) => arr.length,
|
98
|
-
arrayIncludes: ([arr, item]) => arr.includes(item),
|
99
|
-
arrayJoin: ([arr, separator]) => arr.join(separator),
|
100
|
-
// arrayMap: ([arr, fn]): any => arr.map(fn),
|
101
|
-
// arrayFilter: ([arr, fn]): any => arr.filter(fn),
|
102
|
-
// arrayReduce: ([arr, fn, initial]): any => arr.reduce(fn, initial),
|
103
|
-
uniqueArray: ([arr]) => [...new Set(arr)],
|
104
|
-
flattenArray: ([arr]) => arr.flat(),
|
105
|
-
// arraySort: ([arr, compareFn]): any => arr.sort(compareFn),
|
106
|
-
// arrayFind: ([arr, fn]): any => arr.find(fn),
|
107
|
-
// arrayEvery: ([arr, fn]): any => arr.every(fn),
|
108
|
-
// arraySome: ([arr, fn]): any => arr.some(fn),
|
109
|
-
// Object Helpers
|
110
|
-
objectKeys: ([obj]) => Object.keys(obj),
|
111
|
-
objectValues: ([obj]) => Object.values(obj),
|
112
|
-
objectEntries: ([obj]) => Object.entries(obj),
|
113
|
-
objectHasKey: ([obj, key]) => Object.prototype.hasOwnProperty.call(obj, key),
|
114
|
-
mergeObjects: ([obj1, obj2]) => ({ ...obj1, ...obj2 }),
|
115
|
-
deepClone: ([obj]) => JSON.parse(JSON.stringify(obj)),
|
116
|
-
objectFreeze: ([obj]) => Object.freeze(obj),
|
117
|
-
objectMergeDeep: ([obj1, obj2]) => {
|
118
|
-
function mergeDeep(obj1, obj2) {
|
119
|
-
const result = { ...obj1 };
|
120
|
-
for (const key in obj2) {
|
121
|
-
if (obj2[key] instanceof Object && !Array.isArray(obj2[key])) {
|
122
|
-
result[key] = mergeDeep(obj1[key], obj2[key]); // Use the named function 'mergeDeep'
|
123
|
-
}
|
124
|
-
else {
|
125
|
-
result[key] = obj2[key];
|
126
|
-
}
|
127
|
-
}
|
128
|
-
return result;
|
129
|
-
}
|
130
|
-
return mergeDeep(obj1, obj2);
|
131
|
-
},
|
132
|
-
// Random Helpers
|
133
|
-
randomNumber: ([min, max]) => Math.floor(Math.random() * (max - min + 1)) + min,
|
134
|
-
randomElement: ([arr]) => arr[Math.floor(Math.random() * arr.length)],
|
135
|
-
// Formatting Helpers
|
136
|
-
currency: ([amount, currencySymbol]) => `${currencySymbol}${amount.toFixed(2)}`,
|
137
|
-
percent: ([num]) => `${(num * 100).toFixed(2)}%`,
|
138
|
-
// Miscellaneous Helpers
|
139
|
-
jsonStringify: ([obj]) => JSON.stringify(obj),
|
140
|
-
jsonParse: ([str]) => JSON.parse(str),
|
141
|
-
delay: ([ms]) => new Promise((resolve) => setTimeout(resolve, ms)),
|
142
|
-
noop: () => { }, // No operation function
|
143
|
-
deepEqual: ([obj1, obj2]) => JSON.stringify(obj1) === JSON.stringify(obj2), // Deep equality check
|
144
|
-
// Additional String Manipulation Helpers
|
145
|
-
snakeToCamel: ([str]) => str.replace(/([-_]\w)/g, (g) => g[1].toUpperCase()),
|
146
|
-
camelToSnake: ([str]) => str.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase(),
|
147
|
-
// Additional Array Helpers
|
148
|
-
chunkArray: ([arr, size]) => Array.from({ length: Math.ceil(arr.length / size) }, (_, i) => arr.slice(i * size, i * size + size)),
|
149
|
-
shuffleArray: ([arr]) => arr.sort(() => Math.random() - 0.5),
|
150
|
-
removeDuplicates: ([arr]) => arr.filter((item, index) => arr.indexOf(item) === index),
|
151
|
-
// Additional Object Helpers
|
152
|
-
objectMap: ([obj, fn]) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, fn(value)])),
|
153
|
-
});
|
154
|
-
this.memory = new MemoryAddresses();
|
155
|
-
}
|
156
|
-
// Managing Helpers
|
157
|
-
registerHelper(name, fn) {
|
158
|
-
this.helpers[name] = fn;
|
159
|
-
}
|
160
|
-
registerHelpers(helpers) {
|
161
|
-
for (const [name, fn] of Object.entries(helpers)) {
|
162
|
-
this.registerHelper(name, fn);
|
163
|
-
}
|
164
|
-
}
|
165
|
-
getHelper(name) {
|
166
|
-
return this.lookup(name, this.helpers);
|
167
|
-
}
|
168
|
-
applyTemplate(template, data, innerTemplate) {
|
169
|
-
if (typeof template === "string") {
|
170
|
-
const stringResult = this.processHelper(template, data);
|
171
|
-
// console.log({ stringResult });
|
172
|
-
return stringResult;
|
173
|
-
}
|
174
|
-
else if (Array.isArray(template)) {
|
175
|
-
return template.map((item, index) => this.applyTemplate(item, { ...data, currentItem: item, index }));
|
176
|
-
}
|
177
|
-
else if (typeof template === "object") {
|
178
|
-
let result = {};
|
179
|
-
for (const key in template) {
|
180
|
-
if (Object.prototype.hasOwnProperty.call(template, key)) {
|
181
|
-
const value = template[key];
|
182
|
-
const currentKeyResult = this.processHelper(key, data, value);
|
183
|
-
// console.log({ currentKeyResult });
|
184
|
-
if (isThis.isArrayOrObject(currentKeyResult)) {
|
185
|
-
result = this.applyTemplate(currentKeyResult, data);
|
186
|
-
}
|
187
|
-
else {
|
188
|
-
if (value) {
|
189
|
-
result[`${currentKeyResult}`] = this.applyTemplate(value, data);
|
190
|
-
}
|
191
|
-
else {
|
192
|
-
result = currentKeyResult;
|
193
|
-
}
|
194
|
-
}
|
195
|
-
}
|
196
|
-
}
|
197
|
-
return result;
|
198
|
-
}
|
199
|
-
return template;
|
200
|
-
}
|
201
|
-
lookup(varPath, data) {
|
202
|
-
// console.log({ varPath });
|
203
|
-
if (typeof varPath !== "string")
|
204
|
-
return varPath;
|
205
|
-
let normalizedPath = varPath.replace(/\[(\d+)\]|\["(.*?)"\]/g, ".$1$2");
|
206
|
-
if (normalizedPath.startsWith(".")) {
|
207
|
-
normalizedPath = normalizedPath.slice(1);
|
208
|
-
}
|
209
|
-
let path = normalizedPath.split(".");
|
210
|
-
const returnValue = path.reduce((acc, part) => {
|
211
|
-
part = part.replace(/^(['"])([\s\S]*?)\1$/g, (_, __, innerText) => innerText);
|
212
|
-
// console.log({ path, acc, part });
|
213
|
-
return acc?.[part];
|
214
|
-
}, data);
|
215
|
-
// console.log({ returnValue });
|
216
|
-
return returnValue;
|
217
|
-
}
|
218
|
-
sanitizeArg(arg, helperName, data) {
|
219
|
-
const isString = arg.match(/^(['"])([\s\S]*?)\1$/g);
|
220
|
-
if (helperName === "var" && !isString)
|
221
|
-
return arg;
|
222
|
-
if (isString) {
|
223
|
-
// console.log({ arg, message: "into qoutes string" });
|
224
|
-
return arg.replace(/^(['"])([\s\S]*?)\1$/g, (_, __, innerText) => innerText);
|
225
|
-
}
|
226
|
-
if (isThis.isNumberString(arg)) {
|
227
|
-
// console.log({ arg, message: "into number string" });
|
228
|
-
return Number(arg);
|
229
|
-
}
|
230
|
-
if (isThis.isBooleanString(arg)) {
|
231
|
-
return arg === "true";
|
232
|
-
}
|
233
|
-
const lookUpValue = this.lookup(arg, data);
|
234
|
-
const memoryValue = this.memory.getData(arg);
|
235
|
-
// console.log({ lookUpValue, memoryValue, arg });
|
236
|
-
if (!isThis.isNullOrUndefined(memoryValue)) {
|
237
|
-
return memoryValue;
|
238
|
-
}
|
239
|
-
if (!isThis.isUndefined(lookUpValue)) {
|
240
|
-
return lookUpValue;
|
241
|
-
}
|
242
|
-
return arg;
|
243
|
-
}
|
244
|
-
handleSpitStringArgs(stringArg) {
|
245
|
-
let currentQuote = null;
|
246
|
-
let result = [];
|
247
|
-
let currentPart = "";
|
248
|
-
for (let i = 0; i < stringArg.length; i++) {
|
249
|
-
const char = stringArg[i];
|
250
|
-
if (char === " " && currentQuote === null) {
|
251
|
-
if (currentPart) {
|
252
|
-
result.push(currentPart);
|
253
|
-
currentPart = "";
|
254
|
-
}
|
255
|
-
continue;
|
256
|
-
}
|
257
|
-
if (char === '"' || char === "'") {
|
258
|
-
if (currentQuote === char) {
|
259
|
-
currentQuote = null;
|
260
|
-
}
|
261
|
-
else if (currentQuote === null) {
|
262
|
-
currentQuote = char;
|
263
|
-
}
|
264
|
-
}
|
265
|
-
currentPart += char;
|
266
|
-
}
|
267
|
-
if (currentPart) {
|
268
|
-
result.push(currentPart);
|
269
|
-
}
|
270
|
-
return result;
|
271
|
-
}
|
272
|
-
processHelperArgs(helperArgs, data, innerTemplate) {
|
273
|
-
const helperArgsMatches = [...helperArgs.matchAll(/\(([^()]+)\)/g)]?.[0];
|
274
|
-
if (helperArgsMatches) {
|
275
|
-
const innerString = helperArgsMatches[1];
|
276
|
-
const splitedInnerArgs = this.handleSpitStringArgs(innerString);
|
277
|
-
const helperName = splitedInnerArgs[0];
|
278
|
-
const helperArgsArray = splitedInnerArgs.slice(1);
|
279
|
-
const helper = this.getHelper(helperName);
|
280
|
-
if (!helper) {
|
281
|
-
throw new Error("Missing helper: " + helperName);
|
282
|
-
}
|
283
|
-
const splittedArgs = helperArgsArray.map((e) => this.sanitizeArg(e, helperName, data));
|
284
|
-
// console.log({ helperName, helperArgs, helperArgsArray, splittedArgs });
|
285
|
-
let helperResult = helper(splittedArgs, data, innerTemplate);
|
286
|
-
// console.log({ helperResult });
|
287
|
-
let memorykey = null;
|
288
|
-
if (isThis.isArrayOrObject(helperResult)) {
|
289
|
-
memorykey = this.memory.storeData(helperResult);
|
290
|
-
}
|
291
|
-
const returnValue = helperArgs.replace(helperArgsMatches[0], memorykey ? memorykey : `"${helperResult}"`);
|
292
|
-
return this.processHelperArgs(returnValue, data, innerTemplate);
|
293
|
-
}
|
294
|
-
else {
|
295
|
-
return helperArgs;
|
296
|
-
}
|
297
|
-
}
|
298
|
-
processHelper(string, data, innerTemplate, stringMatches) {
|
299
|
-
stringMatches = stringMatches
|
300
|
-
? stringMatches
|
301
|
-
: [...string.matchAll(/{{#(\w+)\s*([^}]*)}}/g)]?.[0];
|
302
|
-
if (stringMatches) {
|
303
|
-
const capturedString = stringMatches[0];
|
304
|
-
const helperName = stringMatches[1];
|
305
|
-
const helperArgs = stringMatches[2];
|
306
|
-
const helper = this.getHelper(helperName);
|
307
|
-
if (!helper) {
|
308
|
-
throw new Error("Missing helper : " + helperName);
|
309
|
-
}
|
310
|
-
let splitedArgs = [];
|
311
|
-
if (!isThis.isEmptyString(helperArgs)) {
|
312
|
-
const processedHelperArgs = this.processHelperArgs(helperArgs, data, innerTemplate);
|
313
|
-
splitedArgs = this.handleSpitStringArgs(processedHelperArgs).map((e) => this.sanitizeArg(e, helperName, data));
|
314
|
-
// console.log({
|
315
|
-
// string,
|
316
|
-
// helperName,
|
317
|
-
// helperArgs,
|
318
|
-
// processedHelperArgs,
|
319
|
-
// splitedArgs,
|
320
|
-
// });
|
321
|
-
}
|
322
|
-
const helperResult = helper(splitedArgs, data, innerTemplate);
|
323
|
-
// console.log({ helperResult });
|
324
|
-
if (isThis.isArrayOrObject(helperResult)) {
|
325
|
-
return helperResult;
|
326
|
-
}
|
327
|
-
const resultString = string.replace(capturedString, helperResult);
|
328
|
-
stringMatches = [...resultString.matchAll(/{{#(\w+)\s*([^}]*)}}/g)]?.[0];
|
329
|
-
// console.log({ resultString, stringMatches });
|
330
|
-
if (stringMatches) {
|
331
|
-
return this.processHelper(resultString, data, innerTemplate, stringMatches);
|
332
|
-
}
|
333
|
-
else {
|
334
|
-
if (isThis.isBooleanString(resultString) &&
|
335
|
-
isThis.isBoolean(helperResult)) {
|
336
|
-
return helperResult;
|
337
|
-
}
|
338
|
-
if (isThis.isNullString(resultString) && isThis.isNull(helperResult)) {
|
339
|
-
return null;
|
340
|
-
}
|
341
|
-
if (isThis.isUndefinedString(resultString) ||
|
342
|
-
isThis.isUndefined(helperResult)) {
|
343
|
-
return undefined;
|
344
|
-
}
|
345
|
-
if ((isThis.isNumberString(resultString) ||
|
346
|
-
isThis.isNumber(helperResult)) &&
|
347
|
-
helperResult === parseFloat(resultString)) {
|
348
|
-
return helperResult;
|
349
|
-
}
|
350
|
-
return resultString;
|
351
|
-
}
|
352
|
-
}
|
353
|
-
else {
|
354
|
-
return string;
|
355
|
-
}
|
356
|
-
}
|
357
|
-
}
|
358
|
-
// const langJson = new LangJSON();
|
359
|
-
// const template = {
|
360
|
-
// "{{#loop items.length}}": { name: "{{#var items[(var index)]}}" },
|
361
|
-
// };
|
362
|
-
// const result = langJson.applyTemplate(template, {
|
363
|
-
// items: ["Apple", "Banana", "Grapes"],
|
364
|
-
// });
|
365
|
-
// const returnValue = {
|
366
|
-
// 1: result,
|
367
|
-
// };
|
368
|
-
// console.log(JSON.stringify(returnValue, null, 2));
|
369
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","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