MCPcopy
hub / github.com/lodash/lodash / baseConformsTo

Function baseConformsTo

lodash.js:2765–2781  ·  view source on GitHub ↗

* The base implementation of `_.conformsTo` which accepts `props` to check. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property predicates to conform to. * @returns {boolean} Returns `true` if `object` conforms, else `

(object, source, props)

Source from the content-addressed store, hash-verified

2763 * @returns {boolean} Returns `true` if `object` conforms, else `false`.
2764 */
2765 function baseConformsTo(object, source, props) {
2766 var length = props.length;
2767 if (object == null) {
2768 return !length;
2769 }
2770 object = Object(object);
2771 while (length--) {
2772 var key = props[length],
2773 predicate = source[key],
2774 value = object[key];
2775
2776 if ((value === undefined && !(key in object)) || !predicate(value)) {
2777 return false;
2778 }
2779 }
2780 return true;
2781 }
2782
2783 /**
2784 * The base implementation of `_.delay` and `_.defer` which accepts `args`

Callers 2

baseConformsFunction · 0.85
conformsToFunction · 0.85

Calls 1

predicateFunction · 0.50

Tested by

no test coverage detected