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.6 to 0.1.7

8

esm/index.d.ts
import type { FetchHelperInit, FetchHelperInput, RequestParams } from './FetchHelper.js';
export * from './FetchHelper.js';
export type WithoutBodyMethod<T = Response> = (input: FetchHelperInput, params?: RequestParams, options?: FetchHelperInit) => Promise<T>;
export type WithBodyMethod<T = Response> = (input: FetchHelperInput, body?: BodyInit | Object, options?: FetchHelperInit) => Promise<T>;
export type InputBodyMethod<T = Response> = (options: FetchHelperInit & {
export type WithoutBodyMethod<T = Response> = <U = T>(input: FetchHelperInput, params?: RequestParams, options?: FetchHelperInit) => Promise<U>;
export type WithBodyMethod<T = Response> = <U = T>(input: FetchHelperInput, body?: BodyInit | Object, options?: FetchHelperInit) => Promise<U>;
export type InputBodyMethod<T = Response> = <U = T>(options: FetchHelperInit & {
input: FetchHelperInput;
}) => Promise<T>;
}) => Promise<U>;
export declare function createInstance<T = Response>(defaultConfig?: FetchHelperInit): (<T_1 = Response>(input: RequestInfo, init?: FetchHelperInit | undefined) => Promise<T_1>) & {

@@ -9,0 +9,0 @@ create: typeof createInstance;

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

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

@@ -8,7 +8,7 @@ import type { FetchHelperInit, FetchHelperInput, RequestParams } from './FetchHelper.js';

export type WithoutBodyMethod<T = Response> = (input: FetchHelperInput, params?: RequestParams, options?: FetchHelperInit) => Promise<T>;
export type WithBodyMethod<T = Response> = (input: FetchHelperInput, body?: BodyInit | Object, options?: FetchHelperInit) => Promise<T>;
export type InputBodyMethod<T = Response> = (options: FetchHelperInit & {
export type WithoutBodyMethod<T = Response> = <U = T> (input: FetchHelperInput, params?: RequestParams, options?: FetchHelperInit) => Promise<U>;
export type WithBodyMethod<T = Response> = <U = T> (input: FetchHelperInput, body?: BodyInit | Object, options?: FetchHelperInit) => Promise<U>;
export type InputBodyMethod<T = Response> = <U = T> (options: FetchHelperInit & {
input: FetchHelperInput
}) => Promise<T>;
}) => Promise<U>;

@@ -42,8 +42,8 @@ export function createInstance<T = Response>(defaultConfig?: FetchHelperInit) {

WITHOUT_BODY_METHODS.map(val => val.toLowerCase() as Lowercase<typeof val>).forEach((value) => {
instance[value] = (input, params, options) => instance<T>(input, { ...defaultConfig, params, method: value, ...options });
instance[value] = (input, params, options) => instance(input, { ...defaultConfig, params, method: value, ...options });
});
WITH_BODY_METHODS.map(val => val.toLowerCase() as Lowercase<typeof val>).forEach((value) => {
instance[value] = (input, body: any, options) => instance<T>(input, { ...defaultConfig, body, method: value, ...options });
instance[value] = (input, body: any, options) => instance(input, { ...defaultConfig, body, method: value, ...options });
});
instance.request = options => instance<T>(options.input, { ...defaultConfig, ...options });
instance.request = options => instance(options.input, { ...defaultConfig, ...options });

@@ -50,0 +50,0 @@ return instance;

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