mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
57
react-app/node_modules/lodash/object/has.js
generated
vendored
Normal file
57
react-app/node_modules/lodash/object/has.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
var baseGet = require('../internal/baseGet'),
|
||||
baseSlice = require('../internal/baseSlice'),
|
||||
isArguments = require('../lang/isArguments'),
|
||||
isArray = require('../lang/isArray'),
|
||||
isIndex = require('../internal/isIndex'),
|
||||
isKey = require('../internal/isKey'),
|
||||
isLength = require('../internal/isLength'),
|
||||
last = require('../array/last'),
|
||||
toPath = require('../internal/toPath');
|
||||
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Checks if `path` is a direct property.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Array|string} path The path to check.
|
||||
* @returns {boolean} Returns `true` if `path` is a direct property, else `false`.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': { 'b': { 'c': 3 } } };
|
||||
*
|
||||
* _.has(object, 'a');
|
||||
* // => true
|
||||
*
|
||||
* _.has(object, 'a.b.c');
|
||||
* // => true
|
||||
*
|
||||
* _.has(object, ['a', 'b', 'c']);
|
||||
* // => true
|
||||
*/
|
||||
function has(object, path) {
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
var result = hasOwnProperty.call(object, path);
|
||||
if (!result && !isKey(path)) {
|
||||
path = toPath(path);
|
||||
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
path = last(path);
|
||||
result = hasOwnProperty.call(object, path);
|
||||
}
|
||||
return result || (isLength(object.length) && isIndex(path, object.length) &&
|
||||
(isArray(object) || isArguments(object)));
|
||||
}
|
||||
|
||||
module.exports = has;
|
Reference in New Issue
Block a user