Files
lodash/conforms.js
John-David Dalton 466c67a8b6 Bump to v4.1.0.
2016-01-29 01:20:57 -08:00

29 lines
790 B
JavaScript

import baseClone from './_baseClone';
import baseConforms from './_baseConforms';
/**
* Creates a function that invokes the predicate properties of `source` with
* the corresponding property values of a given object, returning `true` if
* all predicates return truthy, else `false`.
*
* @static
* @memberOf _
* @category Util
* @param {Object} source The object of property predicates to conform to.
* @returns {Function} Returns the new function.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }
* ];
*
* _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) }));
* // => [{ 'user': 'fred', 'age': 40 }]
*/
function conforms(source) {
return baseConforms(baseClone(source, true));
}
export default conforms;