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`. **Note:** The created function is equivalent to `conformsTo` with `source` partially applied.
const objects = [
{ 'a': 2, 'b': 1 },
{ 'a': 1, 'b': 2 }
]
filter(objects, conforms({ 'b': function(n) { return n > 1 } }))
// => [{ 'a': 1, 'b': 2 }]
| Name | Type | Attribute | Description |
|---|---|---|---|
| source | The object of property predicates to conform to. |
{
"comment": "/**\r\n * Creates a function that invokes the predicate properties of `source` with\r\n * the corresponding property values of a given object, returning `true` if\r\n * all predicates return truthy, else `false`.\r\n *\r\n * **Note:** The created function is equivalent to `conformsTo` with\r\n * `source` partially applied.\r\n *\r\n * @since 4.0.0\r\n * @category Util\r\n * @param {Object} source The object of property predicates to conform to.\r\n * @returns {Function} Returns the new spec function.\r\n * @example\r\n *\r\n * const objects = [\r\n * { 'a': 2, 'b': 1 },\r\n * { 'a': 1, 'b': 2 }\r\n * ]\r\n *\r\n * filter(objects, conforms({ 'b': function(n) { return n > 1 } }))\r\n * // => [{ 'a': 1, 'b': 2 }]\r\n */",
"meta": {
"range": [
873,
962
],
"filename": "conforms.js",
"lineno": 29,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100000848",
"name": "conforms",
"type": "FunctionDeclaration",
"paramnames": [
"source"
]
}
},
"description": "Creates a function that invokes the predicate properties of `source` with\rthe corresponding property values of a given object, returning `true` if\rall predicates return truthy, else `false`.\r\r**Note:** The created function is equivalent to `conformsTo` with\r`source` partially applied.",
"since": "4.0.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Util",
"value": "Util"
}
],
"params": [
{
"type": {
"names": [
"Object"
]
},
"description": "The object of property predicates to conform to.",
"name": "source"
}
],
"returns": [
{
"type": {
"names": [
"function"
]
},
"description": "Returns the new spec function."
}
],
"examples": [
"const objects = [\r { 'a': 2, 'b': 1 },\r { 'a': 1, 'b': 2 }\r]\r\rfilter(objects, conforms({ 'b': function(n) { return n > 1 } }))\r// => [{ 'a': 1, 'b': 2 }]"
],
"name": "conforms",
"longname": "conforms",
"kind": "function",
"scope": "global",
"___id": "T000002R000090",
"___s": true,
"filepath": "conforms.js"
}