Home

function: conformsTo


conformsTo(object: Object, source: Object): boolean

Checks if `object` conforms to `source` by invoking the predicate properties of `source` with the corresponding property values of `object`. **Note:** This method is equivalent to `conforms` when `source` is partially applied.

Example(s):

const object = { 'a': 1, 'b': 2 }

conformsTo(object, { 'b': function(n) { return n > 1 } })
// => true

conformsTo(object, { 'b': function(n) { return n > 2 } })
// => false

Params:

Name Type Attribute Description
object The object to inspect.
source The object of property predicates to conform to.

Returns:

boolean

  {
    "comment": "/**\r\n * Checks if `object` conforms to `source` by invoking the predicate\r\n * properties of `source` with the corresponding property values of `object`.\r\n *\r\n * **Note:** This method is equivalent to `conforms` when `source` is\r\n * partially applied.\r\n *\r\n * @since 4.14.0\r\n * @category Lang\r\n * @param {Object} object The object to inspect.\r\n * @param {Object} source The object of property predicates to conform to.\r\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\r\n * @example\r\n *\r\n * const object = { 'a': 1, 'b': 2 }\r\n *\r\n * conformsTo(object, { 'b': function(n) { return n > 1 } })\r\n * // => true\r\n *\r\n * conformsTo(object, { 'b': function(n) { return n > 2 } })\r\n * // => false\r\n */",
    "meta": {
        "range": [
            808,
            921
        ],
        "filename": "conformsTo.js",
        "lineno": 26,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100000870",
            "name": "conformsTo",
            "type": "FunctionDeclaration",
            "paramnames": [
                "object",
                "source"
            ]
        }
    },
    "description": "Checks if `object` conforms to `source` by invoking the predicate\rproperties of `source` with the corresponding property values of `object`.\r\r**Note:** This method is equivalent to `conforms` when `source` is\rpartially applied.",
    "since": "4.14.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Lang",
            "value": "Lang"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Object"
                ]
            },
            "description": "The object to inspect.",
            "name": "object"
        },
        {
            "type": {
                "names": [
                    "Object"
                ]
            },
            "description": "The object of property predicates to conform to.",
            "name": "source"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "boolean"
                ]
            },
            "description": "Returns `true` if `object` conforms, else `false`."
        }
    ],
    "examples": [
        "const object = { 'a': 1, 'b': 2 }\r\rconformsTo(object, { 'b': function(n) { return n > 1 } })\r// => true\r\rconformsTo(object, { 'b': function(n) { return n > 2 } })\r// => false"
    ],
    "name": "conformsTo",
    "longname": "conformsTo",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000092",
    "___s": true,
    "filepath": "conformsTo.js"
}