UNPKG

@itwin/access-control-client

Version:

Access control client for the iTwin platform

25 lines 1.08 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.hasProperty = hasProperty; /** * Type guard to check if an object has a specific property and narrows the type to Record<string, unknown> * @param obj - Unknown object to check for property existence * @param prop - Property key name to check for * @returns True if the object has the specified property, false otherwise * * @example * ```typescript * const data: unknown = { name: "John", age: 30 }; * if (hasProperty(data, "name")) { * console.log(data.name); // ✅ Type-safe access * } * ``` */ function hasProperty(obj, prop) { return typeof obj === "object" && obj !== null && prop in obj; } //# sourceMappingURL=typeUtils.js.map