source: imaps-frontend/node_modules/@babel/helper-define-polyfill-provider/lib/meta-resolver.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.4 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports.default = createMetaResolver;
5var _utils = require("./utils");
6const PossibleGlobalObjects = new Set(["global", "globalThis", "self", "window"]);
7function createMetaResolver(polyfills) {
8 const {
9 static: staticP,
10 instance: instanceP,
11 global: globalP
12 } = polyfills;
13 return meta => {
14 if (meta.kind === "global" && globalP && (0, _utils.has)(globalP, meta.name)) {
15 return {
16 kind: "global",
17 desc: globalP[meta.name],
18 name: meta.name
19 };
20 }
21 if (meta.kind === "property" || meta.kind === "in") {
22 const {
23 placement,
24 object,
25 key
26 } = meta;
27 if (object && placement === "static") {
28 if (globalP && PossibleGlobalObjects.has(object) && (0, _utils.has)(globalP, key)) {
29 return {
30 kind: "global",
31 desc: globalP[key],
32 name: key
33 };
34 }
35 if (staticP && (0, _utils.has)(staticP, object) && (0, _utils.has)(staticP[object], key)) {
36 return {
37 kind: "static",
38 desc: staticP[object][key],
39 name: `${object}$${key}`
40 };
41 }
42 }
43 if (instanceP && (0, _utils.has)(instanceP, key)) {
44 return {
45 kind: "instance",
46 desc: instanceP[key],
47 name: `${key}`
48 };
49 }
50 }
51 };
52}
Note: See TracBrowser for help on using the repository browser.