fix variable extraction
This commit is contained in:
parent
059111e071
commit
e1d9098eaa
11
dist/smarthbs.variables.js
vendored
11
dist/smarthbs.variables.js
vendored
@ -25,12 +25,17 @@ exports.findVarsInHbsString = (hbsStringArg) => __awaiter(this, void 0, void 0,
|
||||
let tripleCurlyMatches = hbsString.match(tripleCurlyRegex);
|
||||
if (tripleCurlyMatches) {
|
||||
hbsString = hbsString.replace(tripleCurlyRegex, '[[[replaced]]]');
|
||||
varNameArray = plugins.lodash.concat(varNameArray, tripleCurlyMatches);
|
||||
}
|
||||
let doubleCurlyMatches = hbsString.match(doubleCurlyRegex);
|
||||
varNameArray = plugins.lodash.concat(varNameArray, tripleCurlyMatches, doubleCurlyMatches)
|
||||
.map((x) => {
|
||||
if (doubleCurlyMatches) {
|
||||
varNameArray = plugins.lodash.concat(varNameArray, doubleCurlyMatches);
|
||||
}
|
||||
// make sure we are clean from curly brackets
|
||||
varNameArray = varNameArray.map((x) => {
|
||||
return x.match(nameInCurlsRegex)[0];
|
||||
});
|
||||
// make sure are uniq
|
||||
varNameArray = plugins.lodash.uniq(varNameArray);
|
||||
return varNameArray;
|
||||
});
|
||||
@ -67,4 +72,4 @@ exports.checkVarsSatisfaction = (hbsStringArg, varObjectArg) => __awaiter(this,
|
||||
}
|
||||
return missingVarsObject;
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudmFyaWFibGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRoYnMudmFyaWFibGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwRkFBMEY7QUFDMUYsOENBQThDOzs7Ozs7Ozs7O0FBRTlDLDhDQUE2QztBQUU3QywwQkFBMEI7QUFDMUIsSUFBSSxnQkFBZ0IsR0FBRyxzQkFBc0IsQ0FBQTtBQUM3QyxJQUFJLGdCQUFnQixHQUFHLG9CQUFvQixDQUF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Q0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUE7UUFDdkMsSUFBSSxlQUFlLEdBQUcsa0JBQWtCLENBQUE7UUFDeEMsR0FBRyxDQUFDLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxZQUFZLENBQUMsTUFBTSxFQUFFLENBQUMsRUFBRSxFQUFFLENBQUM7WUFDN0MsSUFBSSxRQUFRLEdBQUcsWUFBWSxDQUFFLENBQUMsQ0FBRSxDQUFBO1lBQ2hDLElBQUksWUFBWSxHQUFHLENBQUMsZUFBZSxDQUFFLFFBQVEsQ0FBRSxLQUFLLFNBQVMsQ0FBQyxDQUFBO1lBQzlELEVBQUUsQ0FBQyxDQUFDLFlBQVksSUFBSSxZQUFZLENBQUMsTUFBTSxLQUFLLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztnQkFDcEQsS0FBSztZQUNQLENBQUM7WUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztnQkFDeEIsZUFBZSxHQUFHLGVBQWUsQ0FBRSxRQUFRLENBQUUsQ0FBQTtZQUMvQyxDQUFDO1lBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ04saUJBQWlCLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFBO2dCQUNqQyxDQUFDLEdBQUcsWUFBWSxDQUFDLE1BQU0sQ0FBQTtZQUN6QixDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7SUFDRCxNQUFNLENBQUMsaUJBQWlCLENBQUE7QUFDMUIsQ0FBQyxDQUFBLENBQUEifQ==
|
@ -18,12 +18,19 @@ export let findVarsInHbsString = async (hbsStringArg: string) => {
|
||||
let tripleCurlyMatches = hbsString.match(tripleCurlyRegex)
|
||||
if (tripleCurlyMatches) {
|
||||
hbsString = hbsString.replace(tripleCurlyRegex, '[[[replaced]]]')
|
||||
varNameArray = plugins.lodash.concat(varNameArray, tripleCurlyMatches)
|
||||
}
|
||||
let doubleCurlyMatches = hbsString.match(doubleCurlyRegex)
|
||||
varNameArray = plugins.lodash.concat(varNameArray, tripleCurlyMatches, doubleCurlyMatches)
|
||||
.map((x) => {
|
||||
return x.match(nameInCurlsRegex)[ 0 ]
|
||||
})
|
||||
if (doubleCurlyMatches) {
|
||||
varNameArray = plugins.lodash.concat(varNameArray, doubleCurlyMatches)
|
||||
}
|
||||
|
||||
// make sure we are clean from curly brackets
|
||||
varNameArray = varNameArray.map((x) => {
|
||||
return x.match(nameInCurlsRegex)[ 0 ]
|
||||
})
|
||||
|
||||
// make sure are uniq
|
||||
varNameArray = plugins.lodash.uniq(varNameArray)
|
||||
return varNameArray
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user