.
This commit is contained in:
		
							
								
								
									
										39
									
								
								qwen/nodejs/node_modules/lodash/_hasPath.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								qwen/nodejs/node_modules/lodash/_hasPath.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
var castPath = require('./_castPath'),
 | 
			
		||||
    isArguments = require('./isArguments'),
 | 
			
		||||
    isArray = require('./isArray'),
 | 
			
		||||
    isIndex = require('./_isIndex'),
 | 
			
		||||
    isLength = require('./isLength'),
 | 
			
		||||
    toKey = require('./_toKey');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Checks if `path` exists on `object`.
 | 
			
		||||
 *
 | 
			
		||||
 * @private
 | 
			
		||||
 * @param {Object} object The object to query.
 | 
			
		||||
 * @param {Array|string} path The path to check.
 | 
			
		||||
 * @param {Function} hasFunc The function to check properties.
 | 
			
		||||
 * @returns {boolean} Returns `true` if `path` exists, else `false`.
 | 
			
		||||
 */
 | 
			
		||||
function hasPath(object, path, hasFunc) {
 | 
			
		||||
  path = castPath(path, object);
 | 
			
		||||
 | 
			
		||||
  var index = -1,
 | 
			
		||||
      length = path.length,
 | 
			
		||||
      result = false;
 | 
			
		||||
 | 
			
		||||
  while (++index < length) {
 | 
			
		||||
    var key = toKey(path[index]);
 | 
			
		||||
    if (!(result = object != null && hasFunc(object, key))) {
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
    object = object[key];
 | 
			
		||||
  }
 | 
			
		||||
  if (result || ++index != length) {
 | 
			
		||||
    return result;
 | 
			
		||||
  }
 | 
			
		||||
  length = object == null ? 0 : object.length;
 | 
			
		||||
  return !!length && isLength(length) && isIndex(key, length) &&
 | 
			
		||||
    (isArray(object) || isArguments(object));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = hasPath;
 | 
			
		||||
		Reference in New Issue
	
	Block a user