New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@doctadevs/utils

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doctadevs/utils - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

2

dist/src/http.d.ts

@@ -1,2 +0,2 @@

import { BodyInit } from 'node-fetch';
import 'isomorphic-fetch';
export declare type RequestOptions<DataType = BodyInit> = {

@@ -3,0 +3,0 @@ url: string;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.request = void 0;
const node_fetch_1 = __importDefault(require("node-fetch"));
const request = async ({ url, method = 'GET', data, queryParams = {}, token = '', contentType = 'json', }) => {
let fetchFunction;
try {
fetchFunction = window.fetch.bind(window);
}
catch {
fetchFunction = node_fetch_1.default;
}
return fetchFunction(`${url}${!Object.keys(queryParams).length
? ''
: `?${Object.entries(queryParams)
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join('&')}`}`, {
...(method !== 'GET' ? { body: JSON.stringify(data) } : {}),
headers: {
...(token ? { authorization: `Bearer ${token}` } : {}),
'content-type': contentType,
},
method,
}).then((response) => response.json());
};
require("isomorphic-fetch");
const request = async ({ url, method = 'GET', data, queryParams = {}, token = '', contentType = 'json', }) => fetch(`${url}${!Object.keys(queryParams).length
? ''
: `?${Object.entries(queryParams)
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join('&')}`}`, {
...(method !== 'GET' ? { body: JSON.stringify(data) } : {}),
headers: {
...(token ? { authorization: `Bearer ${token}` } : {}),
'content-type': contentType,
},
method,
}).then((response) => response.json());
exports.request = request;
//# sourceMappingURL=http.js.map
{
"name": "@doctadevs/utils",
"version": "0.0.21",
"version": "0.0.22",
"main": "dist/index.js",

@@ -22,4 +22,4 @@ "types": "dist/index.d.ts",

"@types/debug": "^4.1.6",
"@types/isomorphic-fetch": "^0.0.35",
"@types/node": "^16.3.2",
"@types/node-fetch": "^2.5.11",
"@typescript-eslint/eslint-plugin": "^4.4.1",

@@ -38,5 +38,5 @@ "@typescript-eslint/parser": "^4.28.1",

"@types/uuid": "^8.3.1",
"node-fetch": "^2.6.1",
"isomorphic-fetch": "^3.0.0",
"uuid": "^8.3.2"
}
}

@@ -1,2 +0,2 @@

import fetch, { BodyInit, Response } from 'node-fetch';
import 'isomorphic-fetch';

@@ -19,10 +19,4 @@ export type RequestOptions<DataType = BodyInit> = {

contentType = 'json',
}: RequestOptions<DataT>) => {
let fetchFunction: Function;
try {
fetchFunction = window.fetch.bind(window);
} catch {
fetchFunction = fetch;
}
return fetchFunction(
}: RequestOptions<DataT>) =>
fetch(
`${url}${

@@ -44,2 +38,1 @@ !Object.keys(queryParams).length

).then((response: Response) => response.json());
};

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