나는 백본 컬렉션 findWhere()
기능의 작동 방식을 이해하려고 노력했다, 나는 코드에서 이것을보고 : 난이것은 무엇을 의미합니까? 이 [ '발견'] (기능 (모델) {...})
// Return models with matching attributes. Useful for simple cases of
// `filter`.
where: function(attrs, first) {
var matches = _.matches(attrs);
return this[first ? 'find' : 'filter'](function(model) {
return matches(model.attributes);
});
},
// Return the first model with matching attributes. Useful for simple cases
// of `find`.
findWhere: function(attrs) {
return this.where(attrs, true);
},
return this[first ? 'find' : 'filter'](function(model) {
return matches(model.attributes);
});
이 부분 this['find'](function(model){ ... })
실제로 무엇을 하는가 :이 부분이 무엇을 이해하려고? 불리언 first
양수이면