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

ky

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ky - npm Package Compare versions

Comparing version 0.20.0 to 0.21.0

2

index.d.ts

@@ -378,3 +378,3 @@ /// <reference lib="dom"/>

declare class TimeoutError extends Error {
constructor();
constructor(request: Request);
}

@@ -381,0 +381,0 @@

@@ -159,5 +159,6 @@ /*! MIT License © Sindre Sorhus */

class TimeoutError extends Error {
constructor() {
constructor(request) {
super('Request timed out');
this.name = 'TimeoutError';
this.request = request;
}

@@ -169,3 +170,3 @@ }

// `Promise.race()` workaround (#91)
const timeout = (promise, ms, abortController) =>
const timeout = (request, ms, abortController) =>
new Promise((resolve, reject) => {

@@ -177,7 +178,7 @@ const timeoutID = setTimeout(() => {

reject(new TimeoutError());
reject(new TimeoutError(request));
}, ms);
/* eslint-disable promise/prefer-await-to-then */
promise
globals.fetch(request)
.then(resolve)

@@ -439,3 +440,3 @@ .catch(reject)

return timeout(globals.fetch(this.request.clone()), this._options.timeout, this.abortController);
return timeout(this.request.clone(), this._options.timeout, this.abortController);
}

@@ -442,0 +443,0 @@

{
"name": "ky",
"version": "0.20.0",
"version": "0.21.0",
"description": "Tiny and elegant HTTP client based on the browser Fetch API",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -165,5 +165,6 @@ (function (global, factory) {

class TimeoutError extends Error {
constructor() {
constructor(request) {
super('Request timed out');
this.name = 'TimeoutError';
this.request = request;
}

@@ -175,3 +176,3 @@ }

// `Promise.race()` workaround (#91)
const timeout = (promise, ms, abortController) =>
const timeout = (request, ms, abortController) =>
new Promise((resolve, reject) => {

@@ -183,7 +184,7 @@ const timeoutID = setTimeout(() => {

reject(new TimeoutError());
reject(new TimeoutError(request));
}, ms);
/* eslint-disable promise/prefer-await-to-then */
promise
globals.fetch(request)
.then(resolve)

@@ -445,3 +446,3 @@ .catch(reject)

return timeout(globals.fetch(this.request.clone()), this._options.timeout, this.abortController);
return timeout(this.request.clone(), this._options.timeout, this.abortController);
}

@@ -448,0 +449,0 @@

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