Socket
Socket
Sign inDemoInstall

@vitrical/utils

Package Overview
Dependencies
6
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.0 to 1.4.1

1

api.d.ts

@@ -30,2 +30,3 @@ import { AxiosError } from 'axios';

};
export declare const removeUndefined: (obj: any) => any;
export declare const request: ({ method, url, body, query, headers, }: CustomRequestOptions) => Promise<CustomRequestResponse>;

@@ -32,0 +33,0 @@ export declare const makeMicroserviceRequest: (baseURL: string, key: string) => <T extends unknown>(method: 'get' | 'post' | 'put' | 'delete', url: string, options?: {

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.makeMicroserviceRequest = exports.request = exports.handleApiError = exports.ApiError = void 0;
exports.makeMicroserviceRequest = exports.request = exports.removeUndefined = exports.handleApiError = exports.ApiError = void 0;
const axios_1 = __importDefault(require("axios"));

@@ -79,6 +79,20 @@ function isFetchAvailable() {

exports.handleApiError = handleApiError;
const removeUndefined = (obj) => {
if (typeof obj !== 'object' || !obj)
return obj;
const newObj = {};
for (const key in obj) {
if (obj[key] !== undefined) {
newObj[key] = obj[key];
}
}
return newObj;
};
exports.removeUndefined = removeUndefined;
const request = ({ method, url, body, query, headers, }) => new Promise((resolve, reject) => {
const newStack = new Error().stack;
if (isFetchAvailable() && !isXMLHttpRequestAvailable()) {
const request = fetch(!query || Object.keys(query).length === 0 ? url : url + '?' + new URLSearchParams(query), {
const request = fetch(!query || Object.keys(query).length === 0
? url
: url + '?' + new URLSearchParams((0, exports.removeUndefined)(query)), {
method,

@@ -85,0 +99,0 @@ body: body && typeof body === 'string' ? body : JSON.stringify(body),

2

package.json
{
"name": "@vitrical/utils",
"version": "1.4.0",
"version": "1.4.1",
"description": "Collection of useful functions and typings",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc