You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.0 KiB

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = interceptAndNormalize;
/**
* Map webidl definition names to prototype chain parent
* ex. Console -> console
*
* This helps generate protoChain's and protoChainId's
* ex. Console.log -> console.log
*/
function interceptAndNormalize(parentObjectId) {
// Mapping WebIdl names to their actual representation
const apisToLowercase = new Set(["Console", "Window", "Document", "External", "History", "Location", "Navigator", "Performance", "Screen", "defaultStatus", "Controllers"]); // Mapping WebIdl names to actual names
const apiMappings = new Map([["NavigatorConcurrentHardware", "navigator"], ["NavigatorID", "navigator"], ["NavigatorLanguage", "navigator"], ["NavigatorOnLine", "navigator"], ["NavigatorPlugins", "navigator"], ["NavigatorStorage", "navigator"]]);
if (apiMappings.has(parentObjectId)) {
return apiMappings.get(parentObjectId);
}
return apisToLowercase.has(parentObjectId) ? parentObjectId.toLowerCase() : parentObjectId;
}