Similar to the following code
get(obj,'k1','k2','k3')
.then((v)=>console.log(v))
.else(()=>console.log('值为空'));
Implement the function of the following code
if(obj && obj.k1 && obj.k1.k2 && obj.k1.k2.k3){
console.log(obj.k1.k2.k3);
}else{
console.log('值为空')
}
Using es6+promise implementation
Is this okay?
When I saw the chain call, I thought of lazyman from before.
The implementation is rather ugly. . .
Please refer to it