fix deep add
This commit is contained in:
parent
3ab780e600
commit
bf0007ff3a
11
dist/smartscaf.helpers.js
vendored
11
dist/smartscaf.helpers.js
vendored
@ -24,13 +24,22 @@ exports.deepAddToObject = (objectArg, varStringArg, valueArg) => __awaiter(this,
|
|||||||
return null;
|
return null;
|
||||||
})();
|
})();
|
||||||
// build the tree in suppliedVariables
|
// build the tree in suppliedVariables
|
||||||
|
console.log(referencePointer);
|
||||||
|
console.log(varName);
|
||||||
if (!referencePointer[varName] && !varNameNext) {
|
if (!referencePointer[varName] && !varNameNext) {
|
||||||
referencePointer[varName] = valueArg;
|
referencePointer[varName] = valueArg;
|
||||||
|
referencePointer = null;
|
||||||
}
|
}
|
||||||
else if (!referencePointer[varName] && varNameNext) {
|
else if (!referencePointer[varName] && varNameNext) {
|
||||||
referencePointer[varName] = {};
|
referencePointer[varName] = {};
|
||||||
referencePointer = referencePointer[varName];
|
referencePointer = referencePointer[varName];
|
||||||
}
|
}
|
||||||
|
else if (referencePointer[varName] && varNameNext) {
|
||||||
|
referencePointer = referencePointer[varName];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error('Something is strange!');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzY2FmLmhlbHBlcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNjYWYuaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBRUE7O0dBRUc7QUFDUSxRQUFBLGVBQWUsR0FBRyxDQUFPLFNBQVMsRUFBRSxZQUFvQixFQUFFLFFBQWdCO0lBQ25GLElBQUksYUFBYSxHQUFHLFlBQVksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUE7SUFDM0MsSUFBSSxnQkFBZ0IsR0FBRyxTQUFTLENBQUE7SUFDaEMsR0F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0JBQWdCLENBQUMsT0FBTyxDQUFDLEdBQUcsUUFBUSxDQUFBO1lBQ3BDLGdCQUFnQixHQUFHLElBQUksQ0FBQTtRQUN6QixDQUFDO1FBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLElBQUksV0FBVyxDQUFDLENBQUMsQ0FBQztZQUNyRCxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUE7WUFDOUIsZ0JBQWdCLEdBQUcsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDOUMsQ0FBQztRQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1lBQ3BELGdCQUFnQixHQUFHLGdCQUFnQixDQUFDLE9BQU8sQ0FBQyxDQUFBO1FBQzlDLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNOLE1BQU0sSUFBSSxLQUFLLENBQUMsdUJBQXVCLENBQUMsQ0FBQTtRQUMxQyxDQUFDO0lBQ0gsQ0FBQztBQUNILENBQUMsQ0FBQSxDQUFBIn0=
|
@ -1,2 +1,4 @@
|
|||||||
templateVar1: from default yaml
|
templateVar1: from default yaml
|
||||||
templateVar2: this is another value from yml
|
templateVar2: this is another value from yml
|
||||||
|
templateObject.value1: wow
|
||||||
|
templateObject.value2: here
|
@ -1,3 +1,3 @@
|
|||||||
# this is a from default yaml
|
# this is a wow
|
||||||
# this is a this is another value from yml
|
# this is a here
|
||||||
# this is a undefined variable
|
# this is a undefined variable
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
templateVar1: from default yaml
|
templateVar1: from default yaml
|
||||||
templateVar2: this is another value from yml
|
templateVar2: this is another value from yml
|
||||||
|
templateObject.value1: wow
|
||||||
|
templateObject.value2: here
|
@ -1,3 +1,3 @@
|
|||||||
# this is a {{templateVar1}}
|
# this is a {{templateObject.value1}}
|
||||||
# this is a {{templateVar2}}
|
# this is a {{templateObject.value2}}
|
||||||
# this is a {{templateVar3}}
|
# this is a {{templateVar3}}
|
||||||
|
@ -18,11 +18,18 @@ export let deepAddToObject = async (objectArg, varStringArg: string, valueArg: s
|
|||||||
})()
|
})()
|
||||||
|
|
||||||
// build the tree in suppliedVariables
|
// build the tree in suppliedVariables
|
||||||
|
console.log(referencePointer)
|
||||||
|
console.log(varName)
|
||||||
if (!referencePointer[varName] && !varNameNext) {
|
if (!referencePointer[varName] && !varNameNext) {
|
||||||
referencePointer[varName] = valueArg
|
referencePointer[varName] = valueArg
|
||||||
|
referencePointer = null
|
||||||
} else if (!referencePointer[varName] && varNameNext) {
|
} else if (!referencePointer[varName] && varNameNext) {
|
||||||
referencePointer[varName] = {}
|
referencePointer[varName] = {}
|
||||||
referencePointer = referencePointer[varName]
|
referencePointer = referencePointer[varName]
|
||||||
|
} else if (referencePointer[varName] && varNameNext) {
|
||||||
|
referencePointer = referencePointer[varName]
|
||||||
|
} else {
|
||||||
|
throw new Error('Something is strange!')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user