catto.js 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +4 -1
  2. package/package.json +1 -1
  3. package/request.js +22 -9
package/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  var mod = {};
2
2
  var version = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
3
- var parts = ["random", "Server", "HTML", "request", "AuthClient", "utils", "GitHub", "Base64", "User", "Bitfield", "Application", "TelegramBot", "TelegramMessage", "TelegramChannel", "TelegramMessageBuilder", "TelegramInteraction", "TelegramPaymentInProgress", "TelegramPayment", "TelegramUser", "TelegramFile"];
3
+ var parts = ["random", "Server", "HTML", "request", "utils", "GitHub", "Base64", "Bitfield", "Application", "TelegramBot", "TelegramMessage", "TelegramChannel", "TelegramMessageBuilder", "TelegramInteraction", "TelegramPaymentInProgress", "TelegramPayment", "TelegramUser", "TelegramFile"];
4
4
  if (version >= 18.20) {
5
5
  parts.push("Bot", "MessageBuilder");
6
6
  }
7
+ if (version >= 10.4) {
8
+ parts.push("User", "AuthClient");
9
+ }
7
10
  parts.forEach(part => {
8
11
  mod[part] = require(`./${part}`);
9
12
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Universal module for everything.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/request.js CHANGED
@@ -1,14 +1,27 @@
1
1
  /** @module request */
2
2
 
3
- if (!globalThis.fetch) {
4
- var { default: fetch, Headers, Request, Response } = require("node-fetch");
5
- globalThis.fetch = fetch;
6
- globalThis.Headers = Headers;
7
- globalThis.Request = Request;
8
- globalThis.Response = Response;
9
- }
10
- if (globalThis.fetch && typeof fetch === "undefined") {
11
- var fetch = globalThis.fetch;
3
+ if (typeof globalThis !== "undefined") {
4
+ if (!globalThis.fetch) {
5
+ var { default: fetch, Headers, Request, Response } = require("node-fetch");
6
+ globalThis.fetch = fetch;
7
+ globalThis.Headers = Headers;
8
+ globalThis.Request = Request;
9
+ globalThis.Response = Response;
10
+ }
11
+ if (globalThis.fetch && typeof fetch === "undefined") {
12
+ var fetch = globalThis.fetch;
13
+ }
14
+ } else {
15
+ if (!global.fetch) {
16
+ var { default: fetch, Headers, Request, Response } = require("node-fetch");
17
+ global.fetch = fetch;
18
+ global.Headers = Headers;
19
+ global.Request = Request;
20
+ global.Response = Response;
21
+ }
22
+ if (global.fetch && typeof fetch === "undefined") {
23
+ var fetch = global.fetch;
24
+ }
12
25
  }
13
26
 
14
27
  function wrap(method, options) {