kayle
Version:
Extremely fast and accurate accessibility engine built for any headless tool like playwright or puppeteer.
55 lines • 1.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractArgs = void 0;
function extractArgs(o, watcher) {
const options = {
browser: o.browser,
page: o.page,
cdpSession: o.cdpSession,
timeout: o.timeout || 60000,
noIntercept: o.noIntercept,
browserExtension: o.browserExtension,
_watcher: watcher,
actions: o.actions || [],
hideElements: o.hideElements,
ignore: o.ignore || [],
includeNotices: o.includeNotices,
includeWarnings: o.includeWarnings,
rootElement: o.rootElement,
rules: o.rules || [],
runners: o.runners || ["htmlcs"],
standard: o.standard,
origin: o.origin || (o.html && "http://localhost") || "",
language: o.language || "en",
clip: o.clip,
_kayleRunner: false,
};
if (options.hideElements && Array.isArray(options.hideElements)) {
options.hideElements = options.hideElements.join(",");
}
if (options.ignore) {
options.ignore = options.ignore.map((ignored) => ignored.toLowerCase());
if (!options.includeNotices) {
options.ignore.push("notice");
}
if (!options.includeWarnings) {
options.ignore.push("warning");
}
}
let _includesBaseRunner = false;
options.runners.forEach((runner, runnerIndex, ar) => {
if (runner === "axe" || runner === "htmlcs") {
_includesBaseRunner = true;
}
if (runner === "kayle") {
options._kayleRunner = true;
ar.splice(runnerIndex, 1);
}
});
if (!(_includesBaseRunner || options._kayleRunner)) {
options.runners.push("htmlcs");
}
return options;
}
exports.extractArgs = extractArgs;
//# sourceMappingURL=option.js.map