摘要:
Returnstrueif thevalueis present in thelist, using===to test equality. UsesindexOfinternally, iflistis an Array.检测值是否在列表中出现过,如果出现返回true1 _.include([1, 2, 3], 3);2 => true源码:1 _.include = _.contains = function(obj, target) {2 var found = false;3 if (obj == null) return found;4 if (native... 阅读全文
摘要:
A convenient version of what is perhaps the most common use-case formap: extracting a list of property values.很方便的为你提供一个获取列表值的方法1 var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'curly', age : 60}];2 _.pluck(stooges, 'name');3 => [" 阅读全文
摘要:
Returnstrueif any of the values in thelistpass theiteratortruth test. Short-circuits and stops traversing the list if a true element is found. Delegates to the native methodsome, if present.如果列表中有一个真正的实体值出现,那么将返回true,别名some1 _.any([null, 0, 'yes', false]);2 => true源码: var any = _.some = _ 阅读全文