"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", { value: true }); exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = void 0; /** * Helper TypeGuard that checks if something is defined or not. * @param thing - Anything */ function isDefined(thing) { return typeof thing !== "undefined" && thing !== null; } exports.isDefined = isDefined; /** * Helper TypeGuard that checks if the input is an object with the specified properties. * @param thing - Anything. * @param properties - The name of the properties that should appear in the object. */ function isObjectWithProperties(thing, properties) { if (!isDefined(thing) || typeof thing !== "object") { return false; } for (const property of properties) { if (!objectHasProperty(thing, property)) { return false; } } return true; } exports.isObjectWithProperties = isObjectWithProperties; /** * Helper TypeGuard that checks if the input is an object with the specified property. * @param thing - Any object. * @param property - The name of the property that should appear in the object. */ function objectHasProperty(thing, property) { return (isDefined(thing) && typeof thing === "object" && property in thing); } exports.objectHasProperty = objectHasProperty; //# sourceMappingURL=typeGuards.js.map