summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/lodash/_baseConforms.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/node_modules/lodash/_baseConforms.js')
-rw-r--r--tools/eslint/node_modules/lodash/_baseConforms.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/lodash/_baseConforms.js b/tools/eslint/node_modules/lodash/_baseConforms.js
new file mode 100644
index 0000000000..888434d620
--- /dev/null
+++ b/tools/eslint/node_modules/lodash/_baseConforms.js
@@ -0,0 +1,32 @@
+var keys = require('./keys');
+
+/**
+ * The base implementation of `_.conforms` which doesn't clone `source`.
+ *
+ * @private
+ * @param {Object} source The object of property predicates to conform to.
+ * @returns {Function} Returns the new function.
+ */
+function baseConforms(source) {
+ var props = keys(source),
+ length = props.length;
+
+ return function(object) {
+ if (object == null) {
+ return !length;
+ }
+ var index = length;
+ while (index--) {
+ var key = props[index],
+ predicate = source[key],
+ value = object[key];
+
+ if ((value === undefined && !(key in Object(object))) || !predicate(value)) {
+ return false;
+ }
+ }
+ return true;
+ };
+}
+
+module.exports = baseConforms;