对象赋值函数的实现
对参数obj进行赋值 var assignObj = function(obj, params, value){ … … }
例如: var obj1 = {}, obj2 = {x: {y:1, z: 2}}; assignObj(obj1, [“a”, “b”], 1); // obj1 => {a: {b: 1}}; assignObj(obj2, [“x”, “y”], 3); // obj2 => {x: {y:3, z: 2}}
1 回复
lodash.set