UNPKG

tdesign-vue-next

Version:
87 lines (80 loc) 2.25 kB
/** * tdesign v1.15.2 * (c) 2025 tdesign * @license MIT */ 'use strict'; var _baseGet = require('./dep-bd33cda1.js'); var _baseUnary = require('./dep-79cd6be1.js'); var isArray = require('./dep-ce0157af.js'); var _isIndex = require('./dep-57045e93.js'); var isArrayLike = require('./dep-0c415789.js'); /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } /** * 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 = _baseGet.castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = _baseGet.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 && isArrayLike.isLength(length) && _isIndex.isIndex(key, length) && (isArray.isArray(object) || _baseUnary.isArguments(object)); } /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } exports.hasIn = hasIn; //# sourceMappingURL=dep-5c27b967.js.map