UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

42 lines (41 loc) 1.02 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); // @ts-nocheck const hasPath_1 = __importDefault(require("./hasPath")); /** * @ignore * @private * @param object * @param key */ function baseHasIn(object, key) { return object != null && key in Object(object); } /** * Checks if `path` is a direct or inherited property of `object`. * * @since 5.7.0 * @category Object * @param object The object to query. * @param key The key to check. * @returns Returns `true` if `key` exists, else `false`. * @see [[has]],[[hasPath]],[[hasPathIn]] * @example * * ```js * const object = create({ 'a': create({ 'b': 2 }) }) * * hasIn(object, 'a') * // => true * * hasIn(object, 'b') * // => false * ``` */ function hasIn(object, key) { return object != null && (0, hasPath_1.default)(object, key, baseHasIn); } exports.default = hasIn;