@kaciras/utilities
Advanced tools
Comparing version 0.6.4 to 0.6.5
@@ -466,4 +466,8 @@ const htmlEscapes = { | ||
*/ class FetchClientError extends Error { | ||
constructor(response){ | ||
super(`Fetch failed with status: ${response.status}`); | ||
/* | ||
* Don't do `FetchClientError.prototype.name=<name>` | ||
* because it can not be tree-shaking. | ||
*/ name = "FetchClientError"; | ||
constructor(response, msg){ | ||
super(msg ?? `Fetch failed. (${response.status})`); | ||
this.response = response; | ||
@@ -473,3 +477,2 @@ this.code = response.status; | ||
} | ||
FetchClientError.prototype.name = "FetchClientError"; | ||
const defaultRequest = { | ||
@@ -700,3 +703,3 @@ credentials: "include" | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf | ||
*/ function inherit(parent, value) { | ||
*/ function createInstance(parent, value) { | ||
const proto = typeof parent === "function" ? parent.prototype : parent; | ||
@@ -1115,2 +1118,2 @@ return Object.assign(Object.create(proto), value); | ||
export { AbortError, Composite, FetchClient, FetchClientError, LRUCache, MultiEventEmitter, MultiMap, NeverAbort, rpc as RPC, ResponseFacade, SingleEventEmitter, UnitConvertor, base64url, blobToBase64URL, compositor, dataSizeIEC, dataSizeSI, dragSortContext, durationConvertor, escapeHTML, fetchFile, identity, inherit, isPointerInside, noop, nthInChildren, saveFile, selectFile, sha256, silencePromise, silentCall, sleep, svgToUrl, swapElements, uniqueId }; | ||
export { AbortError, Composite, FetchClient, FetchClientError, LRUCache, MultiEventEmitter, MultiMap, NeverAbort, rpc as RPC, ResponseFacade, SingleEventEmitter, UnitConvertor, base64url, blobToBase64URL, compositor, createInstance, dataSizeIEC, dataSizeSI, dragSortContext, durationConvertor, escapeHTML, fetchFile, identity, isPointerInside, noop, nthInChildren, saveFile, selectFile, sha256, silencePromise, silentCall, sleep, svgToUrl, swapElements, uniqueId }; |
@@ -12,5 +12,6 @@ /** | ||
export declare class FetchClientError extends Error { | ||
name: string; | ||
private readonly response; | ||
private readonly code; | ||
constructor(response: Response); | ||
constructor(response: Response, msg?: string); | ||
} | ||
@@ -17,0 +18,0 @@ type Params = Record<string, any>; |
@@ -63,3 +63,3 @@ export type Awaitable<T> = T | Promise<T>; | ||
*/ | ||
export declare function inherit<P extends object | null, C>(parent: P | Constructor<P>, value: C): P extends null ? C : P & C; | ||
export declare function createInstance<P extends object | null, C>(parent: P | Constructor<P>, value: C): P extends null ? C : P & C; | ||
export {}; |
@@ -183,4 +183,8 @@ import process from 'process'; | ||
*/ class FetchClientError extends Error { | ||
constructor(response){ | ||
super(`Fetch failed with status: ${response.status}`); | ||
/* | ||
* Don't do `FetchClientError.prototype.name=<name>` | ||
* because it can not be tree-shaking. | ||
*/ name = "FetchClientError"; | ||
constructor(response, msg){ | ||
super(msg ?? `Fetch failed. (${response.status})`); | ||
this.response = response; | ||
@@ -190,3 +194,2 @@ this.code = response.status; | ||
} | ||
FetchClientError.prototype.name = "FetchClientError"; | ||
const defaultRequest = { | ||
@@ -706,3 +709,3 @@ credentials: "include" | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf | ||
*/ function inherit(parent, value) { | ||
*/ function createInstance(parent, value) { | ||
const proto = typeof parent === "function" ? parent.prototype : parent; | ||
@@ -1013,2 +1016,2 @@ return Object.assign(Object.create(proto), value); | ||
export { AbortError, Composite, FetchClient, FetchClientError, LRUCache, MultiEventEmitter, MultiMap, NeverAbort, rpc as RPC, ResponseFacade, SingleEventEmitter, UnitConvertor, base64url, blobToBase64URL, compositor, dataSizeIEC, dataSizeSI, durationConvertor, escapeHTML, fetchFile, identity, inherit, noop, onExit, sha256, silencePromise, silentCall, sleep, svgToUrl, uniqueId }; | ||
export { AbortError, Composite, FetchClient, FetchClientError, LRUCache, MultiEventEmitter, MultiMap, NeverAbort, rpc as RPC, ResponseFacade, SingleEventEmitter, UnitConvertor, base64url, blobToBase64URL, compositor, createInstance, dataSizeIEC, dataSizeSI, durationConvertor, escapeHTML, fetchFile, identity, noop, onExit, sha256, silencePromise, silentCall, sleep, svgToUrl, uniqueId }; |
{ | ||
"name": "@kaciras/utilities", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"license": "MIT", | ||
@@ -22,3 +22,3 @@ "description": "A set of common JS functions for node and browser.", | ||
"devDependencies": { | ||
"@jest/globals": "^29.4.1", | ||
"@jest/globals": "^29.4.3", | ||
"@kaciras/eslint-config-core": "^2.5.0", | ||
@@ -28,12 +28,12 @@ "@kaciras/eslint-config-jest": "^2.5.0", | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"@stryker-mutator/core": "^6.3.1", | ||
"@stryker-mutator/jest-runner": "^6.3.1", | ||
"@swc/core": "^1.3.32", | ||
"@stryker-mutator/core": "^6.4.1", | ||
"@stryker-mutator/jest-runner": "^6.4.1", | ||
"@swc/core": "^1.3.36", | ||
"@swc/jest": "^0.2.24", | ||
"@types/node": "^18.11.18", | ||
"eslint": "^8.33.0", | ||
"@types/node": "^18.14.1", | ||
"eslint": "^8.34.0", | ||
"is-builtin-module": "^3.2.1", | ||
"jest": "^29.4.1", | ||
"jest": "^29.4.3", | ||
"mockttp": "^3.6.3", | ||
"rollup": "^3.12.1", | ||
"rollup": "^3.17.2", | ||
"typescript": "^4.9.5" | ||
@@ -40,0 +40,0 @@ }, |
89483
2694