UNPKG

@zowe/imperative

Version:
45 lines 1.38 kB
"use strict"; /* * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html * * SPDX-License-Identifier: EPL-2.0 * * Copyright Contributors to the Zowe Project. * */ Object.defineProperty(exports, "__esModule", { value: true }); exports.JsUtils = void 0; const url_1 = require("url"); class JsUtils { // __________________________________________________________________________ /** * Is the supplied object empty. * * @param {object} objToTest - The object to test. * * @returns {boolean} - True if empty. False otherwise. */ static isObjEmpty(objToTest) { return Object.keys(objToTest !== null && objToTest !== void 0 ? objToTest : {}).length === 0; } // __________________________________________________________________________ /** * Is the supplied string a URL. * * @param {string} urlString - The string to test. * * @returns {boolean} - True if it is a URL. False otherwise. */ static isUrl(urlString) { try { return new url_1.URL(urlString).origin !== "null"; } catch (_) { return false; } } } exports.JsUtils = JsUtils; //# sourceMappingURL=JsUtils.js.map