* Produces a callback bound to an optional `thisArg`. If `func` is a property * name the created callback will return the property value for a given element. * If `func` is an object the created callback will return `true` for elements * that contain the equivalent object properties,
(func, thisArg, argCount)
| 40927 | * // => [{ 'name': 'fred', 'age': 40 }] |
| 40928 | */ |
| 40929 | function createCallback(func, thisArg, argCount) { |
| 40930 | var type = typeof func; |
| 40931 | if (func == null || type == 'function') { |
| 40932 | return baseCreateCallback(func, thisArg, argCount); |
| 40933 | } |
| 40934 | // handle "_.pluck" style callback shorthands |
| 40935 | if (type != 'object') { |
| 40936 | return property(func); |
| 40937 | } |
| 40938 | var props = keys(func), |
| 40939 | key = props[0], |
| 40940 | a = func[key]; |
| 40941 | |
| 40942 | // handle "_.where" style callback shorthands |
| 40943 | if (props.length == 1 && a === a && !isObject(a)) { |
| 40944 | // fast path the common case of providing an object with a single |
| 40945 | // property containing a primitive value |
| 40946 | return function(object) { |
| 40947 | var b = object[key]; |
| 40948 | return a === b && (a !== 0 || (1 / a == 1 / b)); |
| 40949 | }; |
| 40950 | } |
| 40951 | return function(object) { |
| 40952 | var length = props.length, |
| 40953 | result = false; |
| 40954 | |
| 40955 | while (length--) { |
| 40956 | if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) { |
| 40957 | break; |
| 40958 | } |
| 40959 | } |
| 40960 | return result; |
| 40961 | }; |
| 40962 | } |
| 40963 | |
| 40964 | /** |
| 40965 | * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their |
nothing calls this directly
no test coverage detected