Just diving into the world of javascript and have a question to ask (obviously :P). I've developed two methods - one fetches value from an object based on its data path (structure within an object like "object.subObject.anotherSubObject.property"), and another sets a value to an object using the data path.
Check out the TypeScript code snippet below:
public getValueFromObject(object:any, path:string|string[], thisArg:any = null):any {
// code for fetching value from object...
}
private setValueToObject(dataObject:any, value:any, dataPath:string|string[], thisArg:any = null):any {
// code for setting value to object...
}
My query is about the quality of this JavaScript code. Are there any libraries, like lodash, that could simplify what I'm attempting to achieve? It would be great if someone could provide an example code. Thank you in advance!