I am using lodash's get and set to manipulate complex objects. Although Lodash is a good library, it also weighs considerably (about 40kb). I am tring to develop a lean web-app, and lodash takes half of the bundle size.
How would you build safe functions that can replace get and set?
For instance, some function which will change the following object:
Set
const a = {b:2,c:{d:5}}
set(a,"c.d",7)
Which will result
//a = {b:2,c:{d:7}}.
if a = {}, it will result:
{c:{d:7}}
Get
const a = {b:2,c:{d:5}}
let x = get(a,"c.d",0)
Which will result
//x = 5 or if the path doesn't exist, //x = 0