跳到主要内容

findWhere

_.findWhere(list, properties)
遍历整个 list,返回 matches(匹配) properties 参数所列出的所有 键 - 值 对的第一个值。

如果没有找到匹配的属性,或者 list 是空的,那么将返回 undefined

_.findWhere(publicServicePulitzers, {newsroom: "The New York Times"});=> {year: 1918, newsroom: "The New York Times",  reason: "For its public service in publishing in full so many official reports,  documents and speeches by European statesmen relating to the progress and  conduct of the war."}