mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
Update ESLint to 3.0.0. This includes an enhancement to `no-unused-vars` such that it finds a few instances in our code base that it did not find previously (fixed in previous commits readying this for landing). PR-URL: https://github.com/nodejs/node/pull/7601 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
34 lines
757 B
JavaScript
34 lines
757 B
JavaScript
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 spec 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;
|