Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api-reach

Package Overview
Dependencies
Maintainers
0
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-reach - npm Package Compare versions

Comparing version 0.14.0-beta.5 to 0.14.0-beta.6

6

dist/index.js

@@ -16,2 +16,3 @@ "use strict";

const request_js_1 = require("./request/request.js");
const utils_2 = require("./utils");
const defaultOptions = {

@@ -46,3 +47,6 @@ responseType: const_js_1.ExpectedResponseBodyType.json,

this._options = options !== null && options !== void 0 ? options : {};
this._dependencies = Object.assign({ fetch: fetch, URL: URL, FormData: FormData, qsStringify: qs_1.default.stringify, AbortController: AbortController }, dependencies);
this._dependencies = Object.assign({ fetch: (0, utils_2.getFetch)(), URL: URL, FormData: FormData, qsStringify: qs_1.default.stringify, AbortController: AbortController }, dependencies);
if (!this._dependencies.fetch) {
throw new TypeError("No fetch implementation found, please provide fetch function in dependencies");
}
}

@@ -49,0 +53,0 @@ _getResponseType(options) {

3

dist/utils.d.ts
import { ResponseStatusGroup } from "./const.js";
declare const matchStatus: (status: number) => ResponseStatusGroup;
declare const stripHash: (str: string) => string;
export { matchStatus, stripHash, };
declare const getFetch: () => typeof fetch | null;
export { matchStatus, stripHash, getFetch, };
//# sourceMappingURL=utils.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stripHash = exports.matchStatus = void 0;
exports.getFetch = exports.stripHash = exports.matchStatus = void 0;
const const_js_1 = require("./const.js");

@@ -41,2 +41,12 @@ const types = {

exports.stripHash = stripHash;
const getFetch = () => {
if (typeof window !== "undefined") {
return window.fetch.bind(window);
}
if (typeof fetch !== "undefined") {
return fetch;
}
return null;
};
exports.getFetch = getFetch;
//# sourceMappingURL=utils.js.map

@@ -9,2 +9,3 @@ import urlJoin from "url-join";

import { ApiRequest } from "./request/request.js";
import { getFetch } from "./utils.js";
const defaultOptions = {

@@ -44,3 +45,3 @@ responseType: ExpectedResponseBodyType.json,

this._dependencies = {
fetch: fetch,
fetch: getFetch(),
URL: URL,

@@ -52,2 +53,5 @@ FormData: FormData,

};
if (!this._dependencies.fetch) {
throw new TypeError("No fetch implementation found, please provide fetch function in dependencies");
}
}

@@ -54,0 +58,0 @@ _getResponseType(options) {

import { ResponseStatusGroup } from "./const.js";
declare const matchStatus: (status: number) => ResponseStatusGroup;
declare const stripHash: (str: string) => string;
export { matchStatus, stripHash, };
declare const getFetch: () => typeof fetch | null;
export { matchStatus, stripHash, getFetch, };
//# sourceMappingURL=utils.d.ts.map

@@ -36,3 +36,12 @@ import { ResponseStatusGroup } from "./const.js";

};
export { matchStatus, stripHash, };
const getFetch = () => {
if (typeof window !== "undefined") {
return window.fetch.bind(window);
}
if (typeof fetch !== "undefined") {
return fetch;
}
return null;
};
export { matchStatus, stripHash, getFetch, };
//# sourceMappingURL=utils.js.map
{
"name": "api-reach",
"version": "0.14.0-beta.5",
"version": "0.14.0-beta.6",
"repository": "git@github.com:dzek69/api-reach.git",

@@ -5,0 +5,0 @@ "author": "Jacek Nowacki @dzek69 <git-public@dzek.eu>",

@@ -45,2 +45,3 @@ /* eslint-disable max-lines */

import { ApiRequest } from "./request/request.js";
import { getFetch } from "./utils";

@@ -73,3 +74,3 @@ const defaultOptions: Pick<

// TODO this will crash on envs without these, fix by creating a function that "fills missing"
fetch: fetch,
fetch: getFetch() as typeof fetch,
URL: URL,

@@ -81,2 +82,7 @@ FormData: FormData,

};
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!this._dependencies.fetch) {
throw new TypeError("No fetch implementation found, please provide fetch function in dependencies");
}
}

@@ -83,0 +89,0 @@

@@ -59,5 +59,17 @@ /* eslint-disable @typescript-eslint/no-magic-numbers */

const getFetch = () => {
if (typeof window !== "undefined") {
// eslint-disable-next-line no-undef
return window.fetch.bind(window);
}
if (typeof fetch !== "undefined") {
return fetch;
}
return null;
};
export {
matchStatus,
stripHash,
getFetch,
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc