How to use the matcher function from underscore

Find comprehensive JavaScript underscore.matcher code examples handpicked from public code repositorys.

9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
// to each element in a collection, returning the desired result — either
// identity, an arbitrary callback, a property matcher, or a property accessor.
var cb = function(value, context, argCount) {
  if (value == null) return _.identity;
  if (_.isFunction(value)) return optimizeCb(value, context, argCount);
  if (_.isObject(value)) return _.matcher(value);
  return _.property(value);
};
_.iteratee = function(value, context) {
  return cb(value, context, Infinity);
fork icon1
star icon1
watch icon2

+ 9 other calls in file