Lodash 是一个一致性、模块化、高性能的 JavaScript 实用工具库。
Lodash官网:https://www.lodashjs.com/
lodash常用的一些方法(整理):https://www.cnblogs.com/t-sun-j/p/10642568.html
常见 - 深度访问属性:_.get(object, path, [defaultValue])
根据 object对象的path路径获取值。 如果解析 value 是 undefined 会以 defaultValue 取代。
例子:
var object = { 'a': [{ 'b': { 'c': 3 } }] };
_.get(object, 'a[0].b.c');
// => 3
_.get(object, ['a', '0', 'b', 'c']);
// => 3
_.get(object, 'a.b.c', 'default');
// => 'default'