@appium/base-driver
Version:
Base driver class for Appium drivers
26 lines • 1.09 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveExecuteExtensionName = resolveExecuteExtensionName;
const lodash_1 = __importDefault(require("lodash"));
/**
* Resolves the name of extension method corresponding to an `execute` command string
* based on the driver's `executeMethodMap`.
*
* @param commandName - The command name to resolve.
* @returns The resolved extension command name if a mapping exists. Otherwise, the original command name.
*/
function resolveExecuteExtensionName(commandName) {
const Driver = this.constructor;
const methodMap = Driver.executeMethodMap;
if (methodMap && lodash_1.default.isPlainObject(methodMap) && commandName in methodMap) {
const command = methodMap[commandName]?.command;
if (typeof command === 'string') {
return command;
}
}
return commandName;
}
//# sourceMappingURL=extension-command-name.js.map