Skip to content

Commit a33ec95

Browse files
committed
fix: update checkValue to checkAttrValue
1 parent 8d4cf22 commit a33ec95

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

src/index.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,34 @@ export function getAttributes(element) {
5252
}, {});
5353
}
5454

55-
export function checkValue(value) {
55+
// ToDo: duplicate it is in crud.utils
56+
export function checkAttrValue(value) {
5657
if (!value) return false;
5758
if (/{{\s*([\w\W]+)\s*}}/g.test(value)) {
5859
return false;
5960
}
6061

6162
return true;
6263
}
64+
65+
// ToDo: Maybe can be deprciated
66+
export function getValueFromJonDeep(json, path) {
67+
try {
68+
if (typeof json == 'undefined')
69+
return false;
70+
let subpath = path.split('.');
71+
let find = subpath.shift();
72+
if (subpath.length > 0) {
73+
return this.__getValueFromJonDeep(json[find], subpath.join('.'))
74+
}
75+
return json[find];
76+
}
77+
catch (error) {
78+
console.log(error)
79+
return false;
80+
}
81+
}
82+
6383
// hosseins utills
6484

6585
// function to go through all frames
@@ -179,20 +199,6 @@ export function configExecuter(element, key, onSuccess, elementConfig) {
179199
return false;
180200
}
181201

182-
export function UUID(length = 10) {
183-
var result = "";
184-
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
185-
186-
var charactersLength = characters.length;
187-
for (var i = 0; i < length; i++) {
188-
result += characters.charAt(Math.floor(Math.random() * charactersLength));
189-
}
190-
191-
var d = new Date().toTimeString();
192-
var random = d.replace(/[\W_]+/g, "").substr(0, 6);
193-
result += random;
194-
return result;
195-
}
196202

197203
export function parseTextToHtml(text) {
198204
let doc = new DOMParser().parseFromString(text, "text/html");
@@ -257,6 +263,7 @@ export function logger(level = "all") {
257263
}
258264

259265
}
266+
260267
export async function waitForLoad(doc) {
261268

262269
if (doc.contentDocument.readyState === 'loading') {
@@ -320,15 +327,14 @@ export default {
320327
joinBydelimiter,
321328
splitBydelimiter,
322329
parseTextToHtml,
323-
UUID,
324330
configExecuter,
325331
configMatch,
326332
getIframeFromPath,
327333
findIframeFromElement,
328334
getTopMostWindow,
329335
cssPath,
330336
allFrame,
331-
checkValue,
337+
checkAttrValue,
332338
getAttributes,
333339
isJsonString,
334340
getParentFromElement,

0 commit comments

Comments
 (0)