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

@ckpack/fetch-helper

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckpack/fetch-helper - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

2

dist/index.js

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

"use strict";var fetchHelper=(()=>{var a=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var f=(s,n)=>{for(var r in n)a(s,r,{get:n[r],enumerable:!0})},l=(s,n,r,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of I(n))!m.call(s,t)&&t!==r&&a(s,t,{get:()=>n[t],enumerable:!(e=H(n,t))||e.enumerable});return s};var y=s=>l(a({},"__esModule",{value:!0}),s);var q={};f(q,{FetchHelper:()=>i,WITHOUT_BODY_METHODS:()=>h,WITH_BODY_METHODS:()=>c,createInstance:()=>d,default:()=>O,mergeHeaders:()=>u});var T=s=>new URLSearchParams(s).toString(),u=(s,n)=>{let r=new Headers(s);return new Headers(n).forEach((e,t)=>{r.set(t,e)}),r},h=["GET","HEAD","OPTIONS","CONNECT","TRACE"],c=["DELETE","PATCH","POST","PUT"],i=class{defaultInit;input;init;constructor(n){this.defaultInit=n||{}}async request(n,r){this.input=n;let e={...this.defaultInit,...r,headers:u(this.defaultInit?.headers,r?.headers)};if(this.init=e.transformRequest?await e.transformRequest(e,this):e,typeof this.input=="string"){let t=new URL(this.input,this.init.baseURL),o=(this.init.paramsSerializer||T)(this.init.params);o?this.input=`${t.href}${t.search?"&":"?"}${o}`:this.input=t.href}try{let t=await(this.init.adapter||fetch)(this.input,this.init);return this.init.handlerSuccess&&this.init?.handlerSuccess(t),e.transformResponse?e.transformResponse(t,this):t}catch(t){if(this.init.handlerError)this.init?.handlerError(t);else throw t}}};var R={},d=s=>{let n=new i(s),r=n.request.bind(n);return r.default=s||{},r.create=e=>d({...s,...r.default,...e}),h.map(e=>e.toLowerCase()).forEach(e=>{r[e]=(t,o,p)=>r(t,{...s,params:o,method:e,...p})}),c.map(e=>e.toLowerCase()).forEach(e=>{r[e]=(t,o,p)=>r(t,{...s,body:o,method:e,...p})}),r.request=e=>r(e.input,{...s,...e}),r},F=d(R),O=F;return y(q);})();
"use strict";var fetchHelper=(()=>{var a=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var l=(s,n)=>{for(var r in n)a(s,r,{get:n[r],enumerable:!0})},y=(s,n,r,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of I(n))!m.call(s,t)&&t!==r&&a(s,t,{get:()=>n[t],enumerable:!(e=H(n,t))||e.enumerable});return s};var f=s=>y(a({},"__esModule",{value:!0}),s);var q={};l(q,{FetchHelper:()=>i,WITHOUT_BODY_METHODS:()=>h,WITH_BODY_METHODS:()=>c,createInstance:()=>d,default:()=>O,mergeHeaders:()=>u});var T=s=>new URLSearchParams(s).toString(),u=(s,n)=>{let r=new Headers(s);return new Headers(n).forEach((e,t)=>{r.set(t,e)}),r},h=["GET","HEAD","OPTIONS","CONNECT","TRACE"],c=["DELETE","PATCH","POST","PUT"],i=class{defaultInit;input;init;constructor(n){this.defaultInit=n||{}}async request(n,r){this.input=n;let e={...this.defaultInit,...r,headers:u(this.defaultInit?.headers,r?.headers)};if(this.init=e.transformRequest?await e.transformRequest(e,this):e,typeof this.input=="string"){let t=new URL(this.input,this.init.baseURL),o=(this.init.paramsSerializer||T)(this.init.params);o?this.input=`${t.href}${t.search?"&":"?"}${o}`:this.input=t.href}try{let t=await(this.init.adapter||fetch)(this.input,this.init);return this.init.handlerSuccess&&this.init?.handlerSuccess(t),e.transformResponse?e.transformResponse(t,this):t}catch(t){if(this.init.handlerError)this.init?.handlerError(t);else throw t}}};var R={},d=s=>{let n=new i(s),r=n.request.bind(n);return r.default=s||{},r.create=e=>d({...s,...r.default,...e}),h.map(e=>e.toLowerCase()).forEach(e=>{r[e]=(t,o,p)=>r(t,{...s,params:o,method:e,...p})}),c.map(e=>e.toLowerCase()).forEach(e=>{r[e]=(t,o,p)=>r(t,{...s,body:o,method:e,...p})}),r.request=e=>r(e.input,{...s,...e}),r},F=d(R),O=F;return f(q);})();
fetchHelper = fetchHelper.default;

@@ -18,4 +18,4 @@ export declare type RequestParams = URLSearchParams | Record<string | number, any> | undefined;

adapter?: (input?: RequestInfo | URL, init?: RequestInit) => Response;
handlerError?: (error: any) => undefined;
handlerSuccess?: (response: Response) => undefined;
handlerError?: (error?: any) => void;
handlerSuccess?: (response?: Response) => void;
[index: string]: any;

@@ -22,0 +22,0 @@ }

{
"name": "@ckpack/fetch-helper",
"private": false,
"version": "0.1.3",
"version": "0.1.4",
"description": "一个轻量级的工具函数库",

@@ -6,0 +6,0 @@ "sideEffects": false,

@@ -30,4 +30,4 @@ export type RequestParams = URLSearchParams | Record<string | number, any> | undefined;

adapter?: (input?: RequestInfo | URL, init?: RequestInit) => Response
handlerError?: (error: any) => undefined
handlerSuccess?: (response: Response) => undefined
handlerError?: (error?: any) => void
handlerSuccess?: (response?: Response) => void
[index: string]: any

@@ -34,0 +34,0 @@ }

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