摘要:
Return a copy of theobject, filtered to only have values for the whitelistedkeys(or array of valid keys).返回一个对象的副本,筛选过滤,只有白名单键的值1 _.pick({name : 'moe', age: 50, userid : 'moe1'}, 'name', 'age');2 => {name : 'moe', age : 50}源码: _.pick = function(obj) { var r 阅读全文
摘要:
Copy all of the properties in thesourceobjects over to thedestinationobject, and return thedestinationobject. It's in-order, so the last source will override properties of the same name in previous arguments.将源对象属性复制到目标对象,并返回目标对象。它是有序的,所以最后的来源将覆盖以前参数名称相同的属性。1 _.extend({name : 'moe'}, {ag 阅读全文
摘要:
Returns a sorted list of the names of every method in an object — that is to say, the name of every function property of the object.返回对象所包含的方法的列表,按A-Z排序.别名methods_.functions(_);=> ["all", "any", "bind", "bindAll", "clone", "compact", &qu 阅读全文
摘要:
Return all of the values of theobject's properties.返回对象的所有属性的值1 _.values({one : 1, two : 2, three : 3});2 => [1, 2, 3]源码:1 _.values = function(obj) {2 return _.map(obj, _.identity);3 }; 阅读全文
摘要:
Retrieve all the names of theobject's properties.返回对象的所有的属性名称1 _.keys({one : 1, two : 2, three : 3});2 => ["one", "two", "three"]源码:1 _.keys = nativeKeys || function(obj) {2 if (obj !== Object(obj)) throw new TypeError('Invalid object');3 var keys = [];4 阅读全文