How to use the property function from underscore

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

4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
// 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 icon0
star icon2
watch icon0