mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Bump to v4.0.0.
This commit is contained in:
28
conforms.js
Normal file
28
conforms.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import baseClone from './internal/baseClone';
|
||||
import baseConforms from './internal/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;
|
||||
Reference in New Issue
Block a user