From 9851a2bdd614281afa3d7f69b98ec10812ffcc75 Mon Sep 17 00:00:00 2001 From: ztimson Date: Sun, 22 Sep 2024 03:11:09 -0400 Subject: [PATCH] docs --- Home.md | 19 + array.md | 315 +++++ aset.md | 2048 ++++++++++++++++++++++++++++ emitter.md | 239 ++++ errors.md | 3148 +++++++++++++++++++++++++++++++++++++++++++ files.md | 145 ++ http.md | 237 ++++ index.md | 309 +++++ logger.md | 615 +++++++++ math.md | 63 + misc.md | 31 + objects.md | 422 ++++++ promise-progress.md | 600 +++++++++ string.md | 396 ++++++ time.md | 117 ++ types.md | 38 + 16 files changed, 8742 insertions(+) create mode 100644 Home.md create mode 100644 array.md create mode 100644 aset.md create mode 100644 emitter.md create mode 100644 errors.md create mode 100644 files.md create mode 100644 http.md create mode 100644 index.md create mode 100644 logger.md create mode 100644 math.md create mode 100644 misc.md create mode 100644 objects.md create mode 100644 promise-progress.md create mode 100644 string.md create mode 100644 time.md create mode 100644 types.md diff --git a/Home.md b/Home.md new file mode 100644 index 0000000..b554f30 --- /dev/null +++ b/Home.md @@ -0,0 +1,19 @@ +# @ztimson/utils + +## Modules + +- [array](array.md) +- [aset](aset.md) +- [emitter](emitter.md) +- [errors](errors.md) +- [files](files.md) +- [http](http.md) +- [index](index.md) +- [logger](logger.md) +- [math](math.md) +- [misc](misc.md) +- [objects](objects.md) +- [promise-progress](promise-progress.md) +- [string](string.md) +- [time](time.md) +- [types](types.md) diff --git a/array.md b/array.md new file mode 100644 index 0000000..f93e1a2 --- /dev/null +++ b/array.md @@ -0,0 +1,315 @@ +[@ztimson/utils](Home.md) / array + +# array + +## Functions + +### ~~addUnique()~~ + +> **addUnique**\<`T`\>(`array`, `el`): `T`[] + +Only add element to array if it isn't already included + +#### Type Parameters + +• **T** + +#### Parameters + +• **array**: `T`[] + +Target array element will be added to + +• **el**: `T` + +Unique element to add + +#### Returns + +`T`[] + +Array with element if it was unique + +#### Example + +```js +const arr = addUnique([1, 2, 3], 3); +console.log(arr); // Output: [1, 2, 3] +``` + +#### Deprecated + +Use ASet to create unique arrays + +#### Defined in + +src/array.ts:17 + +*** + +### ~~arrayDiff()~~ + +> **arrayDiff**(`a`, `b`): `any`[] + +Find all unique elements in arrays + +#### Parameters + +• **a**: `any`[] + +First array to compare + +• **b**: `any`[] + +Second array to compare + +#### Returns + +`any`[] + +Unique elements + +#### Deprecated + +Use ASet to perform Set operations on arrays + +#### Defined in + +src/array.ts:30 + +*** + +### caseInsensitiveSort() + +> **caseInsensitiveSort**(`prop`): (`a`, `b`) => `number` + +Provides a shorthand for sorting arrays of complex objects by a string property + +#### Parameters + +• **prop**: `string` + +Name of property to use, supports dot notation + +#### Returns + +`Function` + +- Function to handle sort (Meant to be passed to Array.prototype.sort or used in sortFn) + +##### Parameters + +• **a**: `any` + +• **b**: `any` + +##### Returns + +`number` + +#### Example + +```ts +let arr = [{a: 'Apple', b: 123}, {a: 'Carrot', b: 789}, {a: 'banana', b: 456}]; +arr.sort(caseInsensitiveSort('a')); +``` + +#### Defined in + +src/array.ts:49 + +*** + +### findByProp() + +> **findByProp**(`prop`, `value`): (`v`) => `boolean` + +Shorthand to find objects with a property value + +#### Parameters + +• **prop**: `string` + +Property to compare (Dot nation supported) + +• **value**: `any` + +Value property must have + +#### Returns + +`Function` + +Function used by `filter` or `find` + +##### Parameters + +• **v**: `any` + +##### Returns + +`boolean` + +#### Example + +```js +const found = [ + {name: 'Batman'}, + {name: 'Superman'}, +].filter(findByProp('name', 'Batman')); +``` + +#### Defined in + +src/array.ts:73 + +*** + +### flattenArr() + +> **flattenArr**(`arr`, `result`): `any`[] + +Recursively flatten nested arrays + +#### Parameters + +• **arr**: `any`[] + +n-dimensional array + +• **result**: `any`[] = `[]` + +Internal use only -- Keeps track of recursion + +#### Returns + +`any`[] + +- Flattened array + +#### Example + +```ts +const arr = [ + {label: null, url: '/'}, + {label: 'Model Admin', url: '/model-admin'}, + [ + {label: 'Elements', url: '/model-admin/elements'}, + {label: 'Example', url: null} + ] +]; + +console.log(flattenArr(arr)); +// Output: +[ + {label: null, url: '/'}, + {label: 'Model Admin', url: '/model-admin'}, + {label: 'Elements', url: '/model-admin/elements'}, + {label: 'Example', url: null} +] +``` + +#### Defined in + +src/array.ts:105 + +*** + +### makeArray() + +> **makeArray**\<`T`\>(`value`): `T`[] + +Make sure value is an array, if it isn't wrap it in one + +#### Type Parameters + +• **T** + +#### Parameters + +• **value**: `T` \| `T`[] + +Value that should be an array + +#### Returns + +`T`[] + +Value in an array + +#### Defined in + +src/array.ts:155 + +*** + +### ~~makeUnique()~~ + +> **makeUnique**(`arr`): `any`[] + +Make sure every element in array is unique + +#### Parameters + +• **arr**: `any`[] + +Array that will be filtered in place + +#### Returns + +`any`[] + +Original array + +#### Deprecated + +Please use ASet to create a guaranteed unique array + +#### Defined in + +src/array.ts:142 + +*** + +### sortByProp() + +> **sortByProp**(`prop`, `reverse`): (`a`, `b`) => `number` + +Provides a shorthand for sorting arrays of complex objects + +#### Parameters + +• **prop**: `string` + +Name of property to use, supports dot notation + +• **reverse**: `boolean` = `false` + +Reverse the order of the sort + +#### Returns + +`Function` + +- Function to handle sort (Meant to be passed to Array.prototype.sort) + +##### Parameters + +• **a**: `any` + +• **b**: `any` + +##### Returns + +`number` + +#### Example + +```ts +let arr = [{a: {b: 2}}, {a: {b: 3}}, {a: {b: 1}}]; +arr.sort(sortByProp('a.b')); +``` + +#### Defined in + +src/array.ts:123 diff --git a/aset.md b/aset.md new file mode 100644 index 0000000..48ab05e --- /dev/null +++ b/aset.md @@ -0,0 +1,2048 @@ +[@ztimson/utils](Home.md) / aset + +# aset + +## Classes + +### ASet\ + +An array which functions as a set. It guarantees unique elements +and provides set functions for comparisons + +#### Extends + +- `Array` + +#### Type Parameters + +• **T** + +#### Constructors + +##### new ASet() + +> **new ASet**\<`T`\>(`elements`): [`ASet`](aset.md#asett)\<`T`\> + +Array to create set from, duplicate values will be removed + +###### Parameters + +• **elements**: `T`[] = `[]` + +Elements which will be added to set + +###### Returns + +[`ASet`](aset.md#asett)\<`T`\> + +###### Overrides + +`Array.constructor` + +###### Defined in + +src/aset.ts:15 + +#### Properties + +##### \[unscopables\] + +> `readonly` **\[unscopables\]**: `object` + +Is an object whose properties have the value 'true' +when they will be absent when used in a 'with' statement. + +###### \[unscopables\]? + +> `readonly` `optional` **\[unscopables\]**: `boolean` + +Is an object whose properties have the value 'true' +when they will be absent when used in a 'with' statement. + +###### length? + +> `optional` **length**: `boolean` + +Gets or sets the length of the array. This is a number one higher than the highest index in the array. + +###### \[iterator\]? + +> `optional` **\[iterator\]** + +###### at? + +> `optional` **at** + +###### concat? + +> `optional` **concat** + +###### copyWithin? + +> `optional` **copyWithin** + +###### entries? + +> `optional` **entries** + +###### every? + +> `optional` **every** + +###### fill? + +> `optional` **fill** + +###### filter? + +> `optional` **filter** + +###### find? + +> `optional` **find** + +###### findIndex? + +> `optional` **findIndex** + +###### findLast? + +> `optional` **findLast** + +###### findLastIndex? + +> `optional` **findLastIndex** + +###### flat? + +> `optional` **flat** + +###### flatMap? + +> `optional` **flatMap** + +###### forEach? + +> `optional` **forEach** + +###### includes? + +> `optional` **includes** + +###### indexOf? + +> `optional` **indexOf** + +###### join? + +> `optional` **join** + +###### keys? + +> `optional` **keys** + +###### lastIndexOf? + +> `optional` **lastIndexOf** + +###### map? + +> `optional` **map** + +###### pop? + +> `optional` **pop** + +###### push? + +> `optional` **push** + +###### reduce? + +> `optional` **reduce** + +###### reduceRight? + +> `optional` **reduceRight** + +###### reverse? + +> `optional` **reverse** + +###### shift? + +> `optional` **shift** + +###### slice? + +> `optional` **slice** + +###### some? + +> `optional` **some** + +###### sort? + +> `optional` **sort** + +###### splice? + +> `optional` **splice** + +###### toLocaleString? + +> `optional` **toLocaleString** + +###### toReversed? + +> `optional` **toReversed** + +###### toSorted? + +> `optional` **toSorted** + +###### toSpliced? + +> `optional` **toSpliced** + +###### toString? + +> `optional` **toString** + +###### unshift? + +> `optional` **unshift** + +###### values? + +> `optional` **values** + +###### with? + +> `optional` **with** + +###### Inherited from + +`Array.[unscopables]` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:97 + +##### length + +> **length**: `number` + +Gets or sets the length of the array. This is a number one higher than the highest index in the array. + +###### Inherited from + +`Array.length` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1325 + +##### \[species\] + +> `readonly` `static` **\[species\]**: `ArrayConstructor` + +###### Inherited from + +`Array.[species]` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:316 + +#### Accessors + +##### size + +> `get` **size**(): `number` + +Number of elements in set + +###### Returns + +`number` + +###### Defined in + +src/aset.ts:7 + +#### Methods + +##### \[iterator\]() + +> **\[iterator\]**(): `IterableIterator`\<`any`\> + +Iterator + +###### Returns + +`IterableIterator`\<`any`\> + +###### Inherited from + +`Array.[iterator]` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.iterable.d.ts:58 + +##### add() + +> **add**(`el`): `void` + +Add single element to set if unique + +###### Parameters + +• **el**: `T` + +Element to add + +###### Returns + +`void` + +###### Defined in + +src/aset.ts:25 + +##### at() + +> **at**(`index`): `any` + +Returns the item located at the specified index. + +###### Parameters + +• **index**: `number` + +The zero-based index of the desired code unit. A negative index will count back from the last item. + +###### Returns + +`any` + +###### Inherited from + +`Array.at` + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.array.d.ts:24 + +##### concat() + +###### concat(items) + +> **concat**(...`items`): `any`[] + +Combines two or more arrays. +This method returns a new array without modifying any existing arrays. + +###### Parameters + +• ...**items**: `ConcatArray`\<`any`\>[] + +Additional arrays and/or items to add to the end of the array. + +###### Returns + +`any`[] + +###### Inherited from + +`Array.concat` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1349 + +###### concat(items) + +> **concat**(...`items`): `any`[] + +Combines two or more arrays. +This method returns a new array without modifying any existing arrays. + +###### Parameters + +• ...**items**: `any`[] + +Additional arrays and/or items to add to the end of the array. + +###### Returns + +`any`[] + +###### Inherited from + +`Array.concat` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1355 + +##### copyWithin() + +> **copyWithin**(`target`, `start`, `end`?): `this` + +Returns the this object after copying a section of the array identified by start and end +to the same array starting at position target + +###### Parameters + +• **target**: `number` + +If target is negative, it is treated as length+target where length is the +length of the array. + +• **start**: `number` + +If start is negative, it is treated as length+start. If end is negative, it +is treated as length+end. + +• **end?**: `number` + +If not specified, length of the this object is used as its default value. + +###### Returns + +`this` + +###### Inherited from + +`Array.copyWithin` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.core.d.ts:62 + +##### delete() + +> **delete**(`el`): `void` + +Delete element from set + +###### Parameters + +• **el**: `T` + +Element that will be deleted + +###### Returns + +`void` + +###### Defined in + +src/aset.ts:33 + +##### difference() + +> **difference**(`set`): [`ASet`](aset.md#asett)\<`T`\> + +Create list of elements this set has which the comparison set does not + +###### Parameters + +• **set**: [`ASet`](aset.md#asett)\<`T`\> + +Set to compare against + +###### Returns + +[`ASet`](aset.md#asett)\<`T`\> + +Different elements + +###### Defined in + +src/aset.ts:43 + +##### entries() + +> **entries**(): `IterableIterator`\<[`number`, `any`]\> + +Returns an iterable of key, value pairs for every entry in the array + +###### Returns + +`IterableIterator`\<[`number`, `any`]\> + +###### Inherited from + +`Array.entries` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.iterable.d.ts:63 + +##### every() + +###### every(predicate, thisArg) + +> **every**\<`S`\>(`predicate`, `thisArg`?): `this is S[]` + +Determines whether all the members of an array satisfy the specified test. + +###### Type Parameters + +• **S** *extends* `any` + +###### Parameters + +• **predicate** + +A function that accepts up to three arguments. The every method calls +the predicate function for each element in the array until the predicate returns a value +which is coercible to the Boolean value false, or until the end of the array. + +• **thisArg?**: `any` + +An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value. + +###### Returns + +`this is S[]` + +###### Inherited from + +`Array.every` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1432 + +###### every(predicate, thisArg) + +> **every**(`predicate`, `thisArg`?): `boolean` + +Determines whether all the members of an array satisfy the specified test. + +###### Parameters + +• **predicate** + +A function that accepts up to three arguments. The every method calls +the predicate function for each element in the array until the predicate returns a value +which is coercible to the Boolean value false, or until the end of the array. + +• **thisArg?**: `any` + +An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value. + +###### Returns + +`boolean` + +###### Inherited from + +`Array.every` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1441 + +##### fill() + +> **fill**(`value`, `start`?, `end`?): `this` + +Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + +###### Parameters + +• **value**: `any` + +value to fill array section with + +• **start?**: `number` + +index to start filling the array at. If start is negative, it is treated as +length+start where length is the length of the array. + +• **end?**: `number` + +index to stop filling the array at. If end is negative, it is treated as +length+end. + +###### Returns + +`this` + +###### Inherited from + +`Array.fill` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.core.d.ts:51 + +##### filter() + +###### filter(predicate, thisArg) + +> **filter**\<`S`\>(`predicate`, `thisArg`?): `S`[] + +Returns the elements of an array that meet the condition specified in a callback function. + +###### Type Parameters + +• **S** *extends* `any` + +###### Parameters + +• **predicate** + +A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + +• **thisArg?**: `any` + +An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + +###### Returns + +`S`[] + +###### Inherited from + +`Array.filter` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1468 + +###### filter(predicate, thisArg) + +> **filter**(`predicate`, `thisArg`?): `any`[] + +Returns the elements of an array that meet the condition specified in a callback function. + +###### Parameters + +• **predicate** + +A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + +• **thisArg?**: `any` + +An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + +###### Returns + +`any`[] + +###### Inherited from + +`Array.filter` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1474 + +##### find() + +###### find(predicate, thisArg) + +> **find**\<`S`\>(`predicate`, `thisArg`?): `undefined` \| `S` + +Returns the value of the first element in the array where predicate is true, and undefined +otherwise. + +###### Type Parameters + +• **S** *extends* `any` + +###### Parameters + +• **predicate** + +find calls predicate once for each element of the array, in ascending +order, until it finds one where predicate returns true. If such an element is found, find +immediately returns that element value. Otherwise, find returns undefined. + +• **thisArg?**: `any` + +If provided, it will be used as the this value for each invocation of +predicate. If it is not provided, undefined is used instead. + +###### Returns + +`undefined` \| `S` + +###### Inherited from + +`Array.find` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.core.d.ts:29 + +###### find(predicate, thisArg) + +> **find**(`predicate`, `thisArg`?): `any` + +###### Parameters + +• **predicate** + +• **thisArg?**: `any` + +###### Returns + +`any` + +###### Inherited from + +`Array.find` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.core.d.ts:30 + +##### findIndex() + +> **findIndex**(`predicate`, `thisArg`?): `number` + +Returns the index of the first element in the array where predicate is true, and -1 +otherwise. + +###### Parameters + +• **predicate** + +find calls predicate once for each element of the array, in ascending +order, until it finds one where predicate returns true. If such an element is found, +findIndex immediately returns that element index. Otherwise, findIndex returns -1. + +• **thisArg?**: `any` + +If provided, it will be used as the this value for each invocation of +predicate. If it is not provided, undefined is used instead. + +###### Returns + +`number` + +###### Inherited from + +`Array.findIndex` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.core.d.ts:41 + +##### findLast() + +###### findLast(predicate, thisArg) + +> **findLast**\<`S`\>(`predicate`, `thisArg`?): `undefined` \| `S` + +Returns the value of the last element in the array where predicate is true, and undefined +otherwise. + +###### Type Parameters + +• **S** *extends* `any` + +###### Parameters + +• **predicate** + +findLast calls predicate once for each element of the array, in descending +order, until it finds one where predicate returns true. If such an element is found, findLast +immediately returns that element value. Otherwise, findLast returns undefined. + +• **thisArg?**: `any` + +If provided, it will be used as the this value for each invocation of +predicate. If it is not provided, undefined is used instead. + +###### Returns + +`undefined` \| `S` + +###### Inherited from + +`Array.findLast` + +###### Defined in + +node\_modules/typescript/lib/lib.es2023.array.d.ts:29 + +###### findLast(predicate, thisArg) + +> **findLast**(`predicate`, `thisArg`?): `any` + +###### Parameters + +• **predicate** + +• **thisArg?**: `any` + +###### Returns + +`any` + +###### Inherited from + +`Array.findLast` + +###### Defined in + +node\_modules/typescript/lib/lib.es2023.array.d.ts:30 + +##### findLastIndex() + +> **findLastIndex**(`predicate`, `thisArg`?): `number` + +Returns the index of the last element in the array where predicate is true, and -1 +otherwise. + +###### Parameters + +• **predicate** + +findLastIndex calls predicate once for each element of the array, in descending +order, until it finds one where predicate returns true. If such an element is found, +findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1. + +• **thisArg?**: `any` + +If provided, it will be used as the this value for each invocation of +predicate. If it is not provided, undefined is used instead. + +###### Returns + +`number` + +###### Inherited from + +`Array.findLastIndex` + +###### Defined in + +node\_modules/typescript/lib/lib.es2023.array.d.ts:41 + +##### flat() + +> **flat**\<`A`, `D`\>(`this`, `depth`?): `FlatArray`\<`A`, `D`\>[] + +Returns a new array with all sub-array elements concatenated into it recursively up to the +specified depth. + +###### Type Parameters + +• **A** + +• **D** *extends* `number` = `1` + +###### Parameters + +• **this**: `A` + +• **depth?**: `D` + +The maximum recursion depth + +###### Returns + +`FlatArray`\<`A`, `D`\>[] + +###### Inherited from + +`Array.flat` + +###### Defined in + +node\_modules/typescript/lib/lib.es2019.array.d.ts:75 + +##### flatMap() + +> **flatMap**\<`U`, `This`\>(`callback`, `thisArg`?): `U`[] + +Calls a defined callback function on each element of an array. Then, flattens the result into +a new array. +This is identical to a map followed by flat with depth 1. + +###### Type Parameters + +• **U** + +• **This** = `undefined` + +###### Parameters + +• **callback** + +A function that accepts up to three arguments. The flatMap method calls the +callback function one time for each element in the array. + +• **thisArg?**: `This` + +An object to which the this keyword can refer in the callback function. If +thisArg is omitted, undefined is used as the this value. + +###### Returns + +`U`[] + +###### Inherited from + +`Array.flatMap` + +###### Defined in + +node\_modules/typescript/lib/lib.es2019.array.d.ts:64 + +##### forEach() + +> **forEach**(`callbackfn`, `thisArg`?): `void` + +Performs the specified action for each element in an array. + +###### Parameters + +• **callbackfn** + +A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + +• **thisArg?**: `any` + +An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + +###### Returns + +`void` + +###### Inherited from + +`Array.forEach` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1456 + +##### has() + +> **has**(`el`): `boolean` + +Check if set includes element + +###### Parameters + +• **el**: `T` + +Element to look for + +###### Returns + +`boolean` + +True if element was found, false otherwise + +###### Defined in + +src/aset.ts:52 + +##### includes() + +> **includes**(`searchElement`, `fromIndex`?): `boolean` + +Determines whether an array includes a certain element, returning true or false as appropriate. + +###### Parameters + +• **searchElement**: `any` + +The element to search for. + +• **fromIndex?**: `number` + +The position in this array at which to begin searching for searchElement. + +###### Returns + +`boolean` + +###### Inherited from + +`Array.includes` + +###### Defined in + +node\_modules/typescript/lib/lib.es2016.array.include.d.ts:25 + +##### indexOf() + +> **indexOf**(`searchElement`, `fromIndex`?): `number` + +Returns the index of the first occurrence of a value in an array, or -1 if it is not present. + +###### Parameters + +• **searchElement**: `any` + +The value to locate in the array. + +• **fromIndex?**: `number` + +The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + +###### Returns + +`number` + +###### Inherited from + +`Array.indexOf` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1417 + +##### intersection() + +> **intersection**(`set`): [`ASet`](aset.md#asett)\<`T`\> + +Create list of elements this set has in common with the comparison set + +###### Parameters + +• **set**: [`ASet`](aset.md#asett)\<`T`\> + +Set to compare against + +###### Returns + +[`ASet`](aset.md#asett)\<`T`\> + +Set of common elements + +###### Defined in + +src/aset.ts:61 + +##### isDisjointFrom() + +> **isDisjointFrom**(`set`): `boolean` + +Check if this set has no elements in common with the comparison set + +###### Parameters + +• **set**: [`ASet`](aset.md#asett)\<`T`\> + +Set to compare against + +###### Returns + +`boolean` + +True if nothing in common, false otherwise + +###### Defined in + +src/aset.ts:70 + +##### isSubsetOf() + +> **isSubsetOf**(`set`): `boolean` + +Check if all elements in this set are included in the comparison set + +###### Parameters + +• **set**: [`ASet`](aset.md#asett)\<`T`\> + +Set to compare against + +###### Returns + +`boolean` + +True if all elements are included, false otherwise + +###### Defined in + +src/aset.ts:79 + +##### isSuperset() + +> **isSuperset**(`set`): `boolean` + +Check if all elements from comparison set are included in this set + +###### Parameters + +• **set**: [`ASet`](aset.md#asett)\<`T`\> + +Set to compare against + +###### Returns + +`boolean` + +True if all elements are included, false otherwise + +###### Defined in + +src/aset.ts:88 + +##### join() + +> **join**(`separator`?): `string` + +Adds all the elements of an array into a string, separated by the specified separator string. + +###### Parameters + +• **separator?**: `string` + +A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. + +###### Returns + +`string` + +###### Inherited from + +`Array.join` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1360 + +##### keys() + +> **keys**(): `IterableIterator`\<`number`\> + +Returns an iterable of keys in the array + +###### Returns + +`IterableIterator`\<`number`\> + +###### Inherited from + +`Array.keys` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.iterable.d.ts:68 + +##### lastIndexOf() + +> **lastIndexOf**(`searchElement`, `fromIndex`?): `number` + +Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. + +###### Parameters + +• **searchElement**: `any` + +The value to locate in the array. + +• **fromIndex?**: `number` + +The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. + +###### Returns + +`number` + +###### Inherited from + +`Array.lastIndexOf` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1423 + +##### map() + +> **map**\<`U`\>(`callbackfn`, `thisArg`?): `U`[] + +Calls a defined callback function on each element of an array, and returns an array that contains the results. + +###### Type Parameters + +• **U** + +###### Parameters + +• **callbackfn** + +A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + +• **thisArg?**: `any` + +An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + +###### Returns + +`U`[] + +###### Inherited from + +`Array.map` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1462 + +##### pop() + +> **pop**(): `any` + +Removes the last element from an array and returns it. +If the array is empty, undefined is returned and the array is not modified. + +###### Returns + +`any` + +###### Inherited from + +`Array.pop` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1338 + +##### push() + +> **push**(...`items`): `number` + +Appends new elements to the end of an array, and returns the new length of the array. + +###### Parameters + +• ...**items**: `any`[] + +New elements to add to the array. + +###### Returns + +`number` + +###### Inherited from + +`Array.push` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1343 + +##### reduce() + +###### reduce(callbackfn) + +> **reduce**(`callbackfn`): `any` + +Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + +###### Parameters + +• **callbackfn** + +A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + +###### Returns + +`any` + +###### Inherited from + +`Array.reduce` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1480 + +###### reduce(callbackfn, initialValue) + +> **reduce**(`callbackfn`, `initialValue`): `any` + +###### Parameters + +• **callbackfn** + +• **initialValue**: `any` + +###### Returns + +`any` + +###### Inherited from + +`Array.reduce` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1481 + +###### reduce(callbackfn, initialValue) + +> **reduce**\<`U`\>(`callbackfn`, `initialValue`): `U` + +Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + +###### Type Parameters + +• **U** + +###### Parameters + +• **callbackfn** + +A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + +• **initialValue**: `U` + +If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + +###### Returns + +`U` + +###### Inherited from + +`Array.reduce` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1487 + +##### reduceRight() + +###### reduceRight(callbackfn) + +> **reduceRight**(`callbackfn`): `any` + +Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + +###### Parameters + +• **callbackfn** + +A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + +###### Returns + +`any` + +###### Inherited from + +`Array.reduceRight` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1493 + +###### reduceRight(callbackfn, initialValue) + +> **reduceRight**(`callbackfn`, `initialValue`): `any` + +###### Parameters + +• **callbackfn** + +• **initialValue**: `any` + +###### Returns + +`any` + +###### Inherited from + +`Array.reduceRight` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1494 + +###### reduceRight(callbackfn, initialValue) + +> **reduceRight**\<`U`\>(`callbackfn`, `initialValue`): `U` + +Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + +###### Type Parameters + +• **U** + +###### Parameters + +• **callbackfn** + +A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + +• **initialValue**: `U` + +If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + +###### Returns + +`U` + +###### Inherited from + +`Array.reduceRight` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1500 + +##### reverse() + +> **reverse**(): `any`[] + +Reverses the elements in an array in place. +This method mutates the array and returns a reference to the same array. + +###### Returns + +`any`[] + +###### Inherited from + +`Array.reverse` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1365 + +##### shift() + +> **shift**(): `any` + +Removes the first element from an array and returns it. +If the array is empty, undefined is returned and the array is not modified. + +###### Returns + +`any` + +###### Inherited from + +`Array.shift` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1370 + +##### slice() + +> **slice**(`start`?, `end`?): `any`[] + +Returns a copy of a section of an array. +For both start and end, a negative index can be used to indicate an offset from the end of the array. +For example, -2 refers to the second to last element of the array. + +###### Parameters + +• **start?**: `number` + +The beginning index of the specified portion of the array. +If start is undefined, then the slice begins at index 0. + +• **end?**: `number` + +The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. +If end is undefined, then the slice extends to the end of the array. + +###### Returns + +`any`[] + +###### Inherited from + +`Array.slice` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1380 + +##### some() + +> **some**(`predicate`, `thisArg`?): `boolean` + +Determines whether the specified callback function returns true for any element of an array. + +###### Parameters + +• **predicate** + +A function that accepts up to three arguments. The some method calls +the predicate function for each element in the array until the predicate returns a value +which is coercible to the Boolean value true, or until the end of the array. + +• **thisArg?**: `any` + +An object to which the this keyword can refer in the predicate function. +If thisArg is omitted, undefined is used as the this value. + +###### Returns + +`boolean` + +###### Inherited from + +`Array.some` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1450 + +##### sort() + +> **sort**(`compareFn`?): `this` + +Sorts an array in place. +This method mutates the array and returns a reference to the same array. + +###### Parameters + +• **compareFn?** + +Function used to determine the order of the elements. It is expected to return +a negative value if the first argument is less than the second argument, zero if they're equal, and a positive +value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. +```ts +[11,2,22,1].sort((a, b) => a - b) +``` + +###### Returns + +`this` + +###### Inherited from + +`Array.sort` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1391 + +##### splice() + +###### splice(start, deleteCount) + +> **splice**(`start`, `deleteCount`?): `any`[] + +Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + +###### Parameters + +• **start**: `number` + +The zero-based location in the array from which to start removing elements. + +• **deleteCount?**: `number` + +The number of elements to remove. + +###### Returns + +`any`[] + +An array containing the elements that were deleted. + +###### Inherited from + +`Array.splice` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1398 + +###### splice(start, deleteCount, items) + +> **splice**(`start`, `deleteCount`, ...`items`): `any`[] + +Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + +###### Parameters + +• **start**: `number` + +The zero-based location in the array from which to start removing elements. + +• **deleteCount**: `number` + +The number of elements to remove. + +• ...**items**: `any`[] + +Elements to insert into the array in place of the deleted elements. + +###### Returns + +`any`[] + +An array containing the elements that were deleted. + +###### Inherited from + +`Array.splice` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1406 + +##### symmetricDifference() + +> **symmetricDifference**(`set`): [`ASet`](aset.md#asett)\<`any`\> + +Create list of elements that are only in one set but not both (XOR) + +###### Parameters + +• **set**: [`ASet`](aset.md#asett)\<`T`\> + +Set to compare against + +###### Returns + +[`ASet`](aset.md#asett)\<`any`\> + +New set of unique elements + +###### Defined in + +src/aset.ts:97 + +##### toLocaleString() + +> **toLocaleString**(): `string` + +Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. + +###### Returns + +`string` + +###### Inherited from + +`Array.toLocaleString` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1333 + +##### toReversed() + +> **toReversed**(): `any`[] + +Returns a copy of an array with its elements reversed. + +###### Returns + +`any`[] + +###### Inherited from + +`Array.toReversed` + +###### Defined in + +node\_modules/typescript/lib/lib.es2023.array.d.ts:46 + +##### toSorted() + +> **toSorted**(`compareFn`?): `any`[] + +Returns a copy of an array with its elements sorted. + +###### Parameters + +• **compareFn?** + +Function used to determine the order of the elements. It is expected to return +a negative value if the first argument is less than the second argument, zero if they're equal, and a positive +value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. +```ts +[11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22] +``` + +###### Returns + +`any`[] + +###### Inherited from + +`Array.toSorted` + +###### Defined in + +node\_modules/typescript/lib/lib.es2023.array.d.ts:57 + +##### toSpliced() + +###### toSpliced(start, deleteCount, items) + +> **toSpliced**(`start`, `deleteCount`, ...`items`): `any`[] + +Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array. + +###### Parameters + +• **start**: `number` + +The zero-based location in the array from which to start removing elements. + +• **deleteCount**: `number` + +The number of elements to remove. + +• ...**items**: `any`[] + +Elements to insert into the copied array in place of the deleted elements. + +###### Returns + +`any`[] + +The copied array. + +###### Inherited from + +`Array.toSpliced` + +###### Defined in + +node\_modules/typescript/lib/lib.es2023.array.d.ts:66 + +###### toSpliced(start, deleteCount) + +> **toSpliced**(`start`, `deleteCount`?): `any`[] + +Copies an array and removes elements while returning the remaining elements. + +###### Parameters + +• **start**: `number` + +The zero-based location in the array from which to start removing elements. + +• **deleteCount?**: `number` + +The number of elements to remove. + +###### Returns + +`any`[] + +A copy of the original array with the remaining elements. + +###### Inherited from + +`Array.toSpliced` + +###### Defined in + +node\_modules/typescript/lib/lib.es2023.array.d.ts:74 + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an array. + +###### Returns + +`string` + +###### Inherited from + +`Array.toString` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1329 + +##### union() + +> **union**(`set`): [`ASet`](aset.md#asett)\<`any`\> + +Create joined list of elements included in this & the comparison set + +###### Parameters + +• **set**: [`ASet`](aset.md#asett)\<`T`\> \| `T`[] + +Set join + +###### Returns + +[`ASet`](aset.md#asett)\<`any`\> + +New set of both previous sets combined + +###### Defined in + +src/aset.ts:106 + +##### unshift() + +> **unshift**(...`items`): `number` + +Inserts new elements at the start of an array, and returns the new length of the array. + +###### Parameters + +• ...**items**: `any`[] + +Elements to insert at the start of the array. + +###### Returns + +`number` + +###### Inherited from + +`Array.unshift` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1411 + +##### values() + +> **values**(): `IterableIterator`\<`any`\> + +Returns an iterable of values in the array + +###### Returns + +`IterableIterator`\<`any`\> + +###### Inherited from + +`Array.values` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.iterable.d.ts:73 + +##### with() + +> **with**(`index`, `value`): `any`[] + +Copies an array, then overwrites the value at the provided index with the +given value. If the index is negative, then it replaces from the end +of the array. + +###### Parameters + +• **index**: `number` + +The index of the value to overwrite. If the index is +negative, then it replaces from the end of the array. + +• **value**: `any` + +The value to write into the copied array. + +###### Returns + +`any`[] + +The copied array with the updated value. + +###### Inherited from + +`Array.with` + +###### Defined in + +node\_modules/typescript/lib/lib.es2023.array.d.ts:85 + +##### from() + +###### from(arrayLike) + +> `static` **from**\<`T`\>(`arrayLike`): `T`[] + +Creates an array from an array-like object. + +###### Type Parameters + +• **T** + +###### Parameters + +• **arrayLike**: `ArrayLike`\<`T`\> + +An array-like object to convert to an array. + +###### Returns + +`T`[] + +###### Inherited from + +`Array.from` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.core.d.ts:70 + +###### from(arrayLike, mapfn, thisArg) + +> `static` **from**\<`T`, `U`\>(`arrayLike`, `mapfn`, `thisArg`?): `U`[] + +Creates an array from an iterable object. + +###### Type Parameters + +• **T** + +• **U** + +###### Parameters + +• **arrayLike**: `ArrayLike`\<`T`\> + +An array-like object to convert to an array. + +• **mapfn** + +A mapping function to call on every element of the array. + +• **thisArg?**: `any` + +Value of 'this' used to invoke the mapfn. + +###### Returns + +`U`[] + +###### Inherited from + +`Array.from` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.core.d.ts:78 + +###### from(iterable) + +> `static` **from**\<`T`\>(`iterable`): `T`[] + +Creates an array from an iterable object. + +###### Type Parameters + +• **T** + +###### Parameters + +• **iterable**: `Iterable`\<`T`\> \| `ArrayLike`\<`T`\> + +An iterable object to convert to an array. + +###### Returns + +`T`[] + +###### Inherited from + +`Array.from` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.iterable.d.ts:81 + +###### from(iterable, mapfn, thisArg) + +> `static` **from**\<`T`, `U`\>(`iterable`, `mapfn`, `thisArg`?): `U`[] + +Creates an array from an iterable object. + +###### Type Parameters + +• **T** + +• **U** + +###### Parameters + +• **iterable**: `Iterable`\<`T`\> \| `ArrayLike`\<`T`\> + +An iterable object to convert to an array. + +• **mapfn** + +A mapping function to call on every element of the array. + +• **thisArg?**: `any` + +Value of 'this' used to invoke the mapfn. + +###### Returns + +`U`[] + +###### Inherited from + +`Array.from` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.iterable.d.ts:89 + +##### isArray() + +> `static` **isArray**(`arg`): `arg is any[]` + +###### Parameters + +• **arg**: `any` + +###### Returns + +`arg is any[]` + +###### Inherited from + +`Array.isArray` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1512 + +##### of() + +> `static` **of**\<`T`\>(...`items`): `T`[] + +Returns a new array from a set of elements. + +###### Type Parameters + +• **T** + +###### Parameters + +• ...**items**: `T`[] + +A set of elements to include in the new array object. + +###### Returns + +`T`[] + +###### Inherited from + +`Array.of` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.core.d.ts:84 diff --git a/emitter.md b/emitter.md new file mode 100644 index 0000000..7b4449a --- /dev/null +++ b/emitter.md @@ -0,0 +1,239 @@ +[@ztimson/utils](Home.md) / emitter + +# emitter + +## Classes + +### TypedEmitter\ + +#### Extended by + +- [`Logger`](logger.md#logger) + +#### Type Parameters + +• **T** *extends* [`TypedEvents`](emitter.md#typedevents) = [`TypedEvents`](emitter.md#typedevents) + +#### Constructors + +##### new TypedEmitter() + +> **new TypedEmitter**\<`T`\>(): [`TypedEmitter`](emitter.md#typedemittert)\<`T`\> + +###### Returns + +[`TypedEmitter`](emitter.md#typedemittert)\<`T`\> + +#### Methods + +##### emit() + +> **emit**\<`K`\>(`event`, ...`args`): `void` + +###### Type Parameters + +• **K** *extends* `string` \| `number` \| `symbol` + +###### Parameters + +• **event**: `K` + +• ...**args**: `Parameters`\<`T`\[`K`\]\> + +###### Returns + +`void` + +###### Defined in + +src/emitter.ts:36 + +##### off() + +> **off**\<`K`\>(`event`, `listener`): `void` + +###### Type Parameters + +• **K** *extends* `string` \| `number` \| `symbol` = `string` + +###### Parameters + +• **event**: `K` + +• **listener**: `T`\[`K`\] + +###### Returns + +`void` + +###### Defined in + +src/emitter.ts:41 + +##### on() + +> **on**\<`K`\>(`event`, `listener`): () => `void` + +###### Type Parameters + +• **K** *extends* `string` \| `number` \| `symbol` = `string` + +###### Parameters + +• **event**: `K` + +• **listener**: `T`\[`K`\] + +###### Returns + +`Function` + +###### Returns + +`void` + +###### Defined in + +src/emitter.ts:45 + +##### once() + +> **once**\<`K`\>(`event`, `listener`?): `Promise`\<`any`\> + +###### Type Parameters + +• **K** *extends* `string` \| `number` \| `symbol` = `string` + +###### Parameters + +• **event**: `K` + +• **listener?**: `T`\[`K`\] + +###### Returns + +`Promise`\<`any`\> + +###### Defined in + +src/emitter.ts:51 + +##### emit() + +> `static` **emit**(`event`, ...`args`): `void` + +###### Parameters + +• **event**: `any` + +• ...**args**: `any`[] + +###### Returns + +`void` + +###### Defined in + +src/emitter.ts:9 + +##### off() + +> `static` **off**(`event`, `listener`): `void` + +###### Parameters + +• **event**: `any` + +• **listener**: [`Listener`](emitter.md#listener) + +###### Returns + +`void` + +###### Defined in + +src/emitter.ts:14 + +##### on() + +> `static` **on**(`event`, `listener`): () => `void` + +###### Parameters + +• **event**: `any` + +• **listener**: [`Listener`](emitter.md#listener) + +###### Returns + +`Function` + +###### Returns + +`void` + +###### Defined in + +src/emitter.ts:19 + +##### once() + +> `static` **once**(`event`, `listener`?): `Promise`\<`any`\> + +###### Parameters + +• **event**: `any` + +• **listener?**: [`Listener`](emitter.md#listener) + +###### Returns + +`Promise`\<`any`\> + +###### Defined in + +src/emitter.ts:26 + +## Type Aliases + +### Listener() + +> **Listener**: (...`args`) => `any` + +#### Parameters + +• ...**args**: `any`[] + +#### Returns + +`any` + +#### Defined in + +src/emitter.ts:1 + +*** + +### TypedEvents + +> **TypedEvents**: \{ \[k in string \| symbol\]: Listener \} & `object` + +#### Type declaration + +##### \*() + +> **\***: (`event`, ...`args`) => `any` + +###### Parameters + +• **event**: `string` + +• ...**args**: `any`[] + +###### Returns + +`any` + +#### Defined in + +src/emitter.ts:2 diff --git a/errors.md b/errors.md new file mode 100644 index 0000000..032f830 --- /dev/null +++ b/errors.md @@ -0,0 +1,3148 @@ +[@ztimson/utils](Home.md) / errors + +# errors + +## Classes + +### BadGatewayError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new BadGatewayError() + +> **new BadGatewayError**(`message`): [`BadGatewayError`](errors.md#badgatewayerror) + +###### Parameters + +• **message**: `string` = `'Bad Gateway'` + +###### Returns + +[`BadGatewayError`](errors.md#badgatewayerror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:143 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `502` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:141 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:147 + +*** + +### BadRequestError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new BadRequestError() + +> **new BadRequestError**(`message`): [`BadRequestError`](errors.md#badrequesterror) + +###### Parameters + +• **message**: `string` = `'Bad Request'` + +###### Returns + +[`BadRequestError`](errors.md#badrequesterror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:35 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `400` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:33 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:39 + +*** + +### CustomError + +#### Extends + +- `Error` + +#### Extended by + +- [`BadRequestError`](errors.md#badrequesterror) +- [`UnauthorizedError`](errors.md#unauthorizederror) +- [`PaymentRequiredError`](errors.md#paymentrequirederror) +- [`ForbiddenError`](errors.md#forbiddenerror) +- [`NotFoundError`](errors.md#notfounderror) +- [`MethodNotAllowedError`](errors.md#methodnotallowederror) +- [`NotAcceptableError`](errors.md#notacceptableerror) +- [`InternalServerError`](errors.md#internalservererror) +- [`NotImplementedError`](errors.md#notimplementederror) +- [`BadGatewayError`](errors.md#badgatewayerror) +- [`ServiceUnavailableError`](errors.md#serviceunavailableerror) +- [`GatewayTimeoutError`](errors.md#gatewaytimeouterror) + +#### Constructors + +##### new CustomError() + +> **new CustomError**(`message`?, `code`?): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **message?**: `string` + +• **code?**: `number` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Overrides + +`Error.constructor` + +###### Defined in + +src/errors.ts:8 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +`Error.cause` + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +`Error.message` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +`Error.name` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +`Error.stack` + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `500` + +###### Defined in + +src/errors.ts:2 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +`Error.prepareStackTrace` + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +`Error.stackTraceLimit` + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +`Error.captureStackTrace` + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Defined in + +src/errors.ts:23 + +*** + +### ForbiddenError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new ForbiddenError() + +> **new ForbiddenError**(`message`): [`ForbiddenError`](errors.md#forbiddenerror) + +###### Parameters + +• **message**: `string` = `'Forbidden'` + +###### Returns + +[`ForbiddenError`](errors.md#forbiddenerror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:71 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `403` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:69 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:75 + +*** + +### GatewayTimeoutError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new GatewayTimeoutError() + +> **new GatewayTimeoutError**(`message`): [`GatewayTimeoutError`](errors.md#gatewaytimeouterror) + +###### Parameters + +• **message**: `string` = `'Gateway Timeout'` + +###### Returns + +[`GatewayTimeoutError`](errors.md#gatewaytimeouterror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:167 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `504` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:165 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:171 + +*** + +### InternalServerError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new InternalServerError() + +> **new InternalServerError**(`message`): [`InternalServerError`](errors.md#internalservererror) + +###### Parameters + +• **message**: `string` = `'Internal Server Error'` + +###### Returns + +[`InternalServerError`](errors.md#internalservererror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:119 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `500` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:117 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:123 + +*** + +### MethodNotAllowedError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new MethodNotAllowedError() + +> **new MethodNotAllowedError**(`message`): [`MethodNotAllowedError`](errors.md#methodnotallowederror) + +###### Parameters + +• **message**: `string` = `'Method Not Allowed'` + +###### Returns + +[`MethodNotAllowedError`](errors.md#methodnotallowederror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:95 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `405` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:93 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:99 + +*** + +### NotAcceptableError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new NotAcceptableError() + +> **new NotAcceptableError**(`message`): [`NotAcceptableError`](errors.md#notacceptableerror) + +###### Parameters + +• **message**: `string` = `'Not Acceptable'` + +###### Returns + +[`NotAcceptableError`](errors.md#notacceptableerror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:107 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `406` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:105 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:111 + +*** + +### NotFoundError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new NotFoundError() + +> **new NotFoundError**(`message`): [`NotFoundError`](errors.md#notfounderror) + +###### Parameters + +• **message**: `string` = `'Not Found'` + +###### Returns + +[`NotFoundError`](errors.md#notfounderror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:83 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `404` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:81 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:87 + +*** + +### NotImplementedError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new NotImplementedError() + +> **new NotImplementedError**(`message`): [`NotImplementedError`](errors.md#notimplementederror) + +###### Parameters + +• **message**: `string` = `'Not Implemented'` + +###### Returns + +[`NotImplementedError`](errors.md#notimplementederror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:131 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `501` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:129 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:135 + +*** + +### PaymentRequiredError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new PaymentRequiredError() + +> **new PaymentRequiredError**(`message`): [`PaymentRequiredError`](errors.md#paymentrequirederror) + +###### Parameters + +• **message**: `string` = `'Payment Required'` + +###### Returns + +[`PaymentRequiredError`](errors.md#paymentrequirederror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:59 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `402` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:57 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:63 + +*** + +### ServiceUnavailableError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new ServiceUnavailableError() + +> **new ServiceUnavailableError**(`message`): [`ServiceUnavailableError`](errors.md#serviceunavailableerror) + +###### Parameters + +• **message**: `string` = `'Service Unavailable'` + +###### Returns + +[`ServiceUnavailableError`](errors.md#serviceunavailableerror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:155 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `503` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:153 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:159 + +*** + +### UnauthorizedError + +#### Extends + +- [`CustomError`](errors.md#customerror) + +#### Constructors + +##### new UnauthorizedError() + +> **new UnauthorizedError**(`message`): [`UnauthorizedError`](errors.md#unauthorizederror) + +###### Parameters + +• **message**: `string` = `'Unauthorized'` + +###### Returns + +[`UnauthorizedError`](errors.md#unauthorizederror) + +###### Overrides + +[`CustomError`](errors.md#customerror).[`constructor`](errors.md#constructors-2) + +###### Defined in + +src/errors.ts:47 + +#### Properties + +##### cause? + +> `optional` **cause**: `unknown` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`cause`](errors.md#cause-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +##### message + +> **message**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`message`](errors.md#message-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1076 + +##### name + +> **name**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`name`](errors.md#name-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1075 + +##### stack? + +> `optional` **stack**: `string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stack`](errors.md#stack-2) + +###### Defined in + +node\_modules/typescript/lib/lib.es5.d.ts:1077 + +##### code + +> `static` **code**: `number` = `401` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-4) + +###### Defined in + +src/errors.ts:45 + +##### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +###### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +###### Returns + +`any` + +###### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`prepareStackTrace`](errors.md#preparestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:27 + +##### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`stackTraceLimit`](errors.md#stacktracelimit-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:29 + +#### Accessors + +##### code + +> `get` **code**(): `number` + +> `set` **code**(`c`): `void` + +###### Parameters + +• **c**: `number` + +###### Returns + +`number` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`code`](errors.md#code-5) + +###### Defined in + +src/errors.ts:5 + +#### Methods + +##### toString() + +> **toString**(): `string` + +Returns a string representation of an object. + +###### Returns + +`string` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`toString`](errors.md#tostring-2) + +###### Defined in + +src/errors.ts:27 + +##### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +###### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +###### Returns + +`void` + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`captureStackTrace`](errors.md#capturestacktrace-2) + +###### Defined in + +node\_modules/@types/node/globals.d.ts:20 + +##### from() + +> `static` **from**(`err`): [`CustomError`](errors.md#customerror) + +###### Parameters + +• **err**: `Error` + +###### Returns + +[`CustomError`](errors.md#customerror) + +###### Inherited from + +[`CustomError`](errors.md#customerror).[`from`](errors.md#from-2) + +###### Defined in + +src/errors.ts:13 + +##### instanceof() + +> `static` **instanceof**(`err`): `boolean` + +###### Parameters + +• **err**: `Error` + +###### Returns + +`boolean` + +###### Overrides + +[`CustomError`](errors.md#customerror).[`instanceof`](errors.md#instanceof-2) + +###### Defined in + +src/errors.ts:51 + +## Functions + +### errorFromCode() + +> **errorFromCode**(`code`, `message`?): `null` \| [`CustomError`](errors.md#customerror) + +Create the correct error object from a status code + +#### Parameters + +• **code**: `number` + +Will be converted to respective error (ex. 404 -> NotFoundError) + +• **message?**: `string` + +Override default error message + +#### Returns + +`null` \| [`CustomError`](errors.md#customerror) + +The proper error type + +#### Defined in + +src/errors.ts:182 diff --git a/files.md b/files.md new file mode 100644 index 0000000..f6a6ba4 --- /dev/null +++ b/files.md @@ -0,0 +1,145 @@ +[@ztimson/utils](Home.md) / files + +# files + +## Functions + +### download() + +> **download**(`href`, `name`?): `void` + +Download a file from a URL + +#### Parameters + +• **href**: `any` + +URL that will be downloaded + +• **name?**: `string` + +Override download name + +#### Returns + +`void` + +#### Defined in + +src/files.ts:10 + +*** + +### downloadBlob() + +> **downloadBlob**(`blob`, `name`): `void` + +Download blob as a file + +#### Parameters + +• **blob**: `Blob` + +File as a blob + +• **name**: `string` + +Name blob will be downloaded as + +#### Returns + +`void` + +#### Defined in + +src/files.ts:25 + +*** + +### fileBrowser() + +> **fileBrowser**(`options`): `Promise`\<`File`[]\> + +Open filebrowser & return selected file + +#### Parameters + +• **options** = `{}` + +accept - selectable mimetypes, multiple - Allow selecting more than 1 file + +• **options.accept?**: `string` + +• **options.multiple?**: `boolean` + +#### Returns + +`Promise`\<`File`[]\> + +Array of selected files + +#### Defined in + +src/files.ts:37 + +*** + +### timestampFilename() + +> **timestampFilename**(`name`?, `date`?): `string` + +Create timestamp intended for filenames from a date + +#### Parameters + +• **name?**: `string` + +Name of file, `{{TIMESTAMP}}` will be replaced + +• **date?**: `string` \| `number` \| `Date` = `...` + +Date to use for timestamp + +#### Returns + +`string` + +Interpolated filename, or the raw timestamp if name was omitted + +#### Defined in + +src/files.ts:60 + +*** + +### uploadWithProgress() + +> **uploadWithProgress**\<`T`\>(`options`): [`PromiseProgress`](promise-progress.md#promiseprogresst)\<`T`\> + +Upload file to URL with progress callback using PromiseProgress + +#### Type Parameters + +• **T** + +#### Parameters + +• **options** + +• **options.files**: `File`[] + +• **options.headers?** + +• **options.url**: `string` + +• **options.withCredentials?**: `boolean` + +#### Returns + +[`PromiseProgress`](promise-progress.md#promiseprogresst)\<`T`\> + +Promise of request with `onProgress` callback + +#### Defined in + +src/files.ts:72 diff --git a/http.md b/http.md new file mode 100644 index 0000000..1680f1a --- /dev/null +++ b/http.md @@ -0,0 +1,237 @@ +[@ztimson/utils](Home.md) / http + +# http + +## Classes + +### Http + +#### Constructors + +##### new Http() + +> **new Http**(`defaults`): [`Http`](http.md#http) + +###### Parameters + +• **defaults**: [`HttpDefaults`](http.md#httpdefaults) = `{}` + +###### Returns + +[`Http`](http.md#http) + +###### Defined in + +src/http.ts:35 + +#### Properties + +##### headers + +> **headers**: `object` = `{}` + +###### Index Signature + + \[`key`: `string`\]: `string` \| `null` \| `undefined` + +###### Defined in + +src/http.ts:32 + +##### url + +> **url**: `null` \| `string` + +###### Defined in + +src/http.ts:33 + +##### headers + +> `static` **headers**: `object` = `{}` + +###### Index Signature + + \[`key`: `string`\]: `string` \| `null` \| `undefined` + +###### Defined in + +src/http.ts:28 + +#### Methods + +##### addInterceptor() + +> **addInterceptor**(`fn`): () => `void` + +###### Parameters + +• **fn**: [`HttpInterceptor`](http.md#httpinterceptor) + +###### Returns + +`Function` + +###### Returns + +`void` + +###### Defined in + +src/http.ts:49 + +##### request() + +> **request**\<`T`\>(`opts`): [`PromiseProgress`](promise-progress.md#promiseprogresst)\<[`DecodedResponse`](http.md#decodedresponset)\<`T`\>\> + +###### Type Parameters + +• **T** + +###### Parameters + +• **opts**: [`HttpRequestOptions`](http.md#httprequestoptions) = `{}` + +###### Returns + +[`PromiseProgress`](promise-progress.md#promiseprogresst)\<[`DecodedResponse`](http.md#decodedresponset)\<`T`\>\> + +###### Defined in + +src/http.ts:55 + +##### addInterceptor() + +> `static` **addInterceptor**(`fn`): () => `void` + +###### Parameters + +• **fn**: [`HttpInterceptor`](http.md#httpinterceptor) + +###### Returns + +`Function` + +###### Returns + +`void` + +###### Defined in + +src/http.ts:43 + +## Type Aliases + +### DecodedResponse\ + +> **DecodedResponse**\<`T`\>: `Response` & `object` + +#### Type declaration + +##### data + +> **data**: `T` \| `null` + +#### Type Parameters + +• **T** + +#### Defined in + +src/http.ts:4 + +*** + +### HttpDefaults + +> **HttpDefaults**: `object` + +#### Type declaration + +##### headers? + +> `optional` **headers**: `object` + +###### Index Signature + + \[`key`: `string` \| `symbol`\]: `string` \| `null` \| `undefined` + +##### interceptors? + +> `optional` **interceptors**: [`HttpInterceptor`](http.md#httpinterceptor)[] + +##### url? + +> `optional` **url**: `string` + +#### Defined in + +src/http.ts:19 + +*** + +### HttpInterceptor() + +> **HttpInterceptor**: (`response`, `next`) => `void` + +#### Parameters + +• **response**: `Response` + +• **next** + +#### Returns + +`void` + +#### Defined in + +src/http.ts:6 + +*** + +### HttpRequestOptions + +> **HttpRequestOptions**: `object` + +#### Index Signature + + \[`key`: `string`\]: `any` + +#### Type declaration + +##### body? + +> `optional` **body**: `any` + +##### decode? + +> `optional` **decode**: `boolean` + +##### fragment? + +> `optional` **fragment**: `string` + +##### headers? + +> `optional` **headers**: `object` + +###### Index Signature + + \[`key`: `string` \| `symbol`\]: `string` \| `null` \| `undefined` + +##### method? + +> `optional` **method**: `"GET"` \| `"POST"` \| `"PATCH"` \| `"PUT"` \| `"DELETE"` + +##### query? + +> `optional` **query**: `object`[] \| `object` + +##### url? + +> `optional` **url**: `string` + +#### Defined in + +src/http.ts:8 diff --git a/index.md b/index.md new file mode 100644 index 0000000..10beb4b --- /dev/null +++ b/index.md @@ -0,0 +1,309 @@ +[@ztimson/utils](Home.md) / index + +# index + +## References + +### addUnique + +Re-exports [addUnique](array.md#addunique) + +### arrayDiff + +Re-exports [arrayDiff](array.md#arraydiff) + +### ASet + +Re-exports [ASet](aset.md#asett) + +### BadGatewayError + +Re-exports [BadGatewayError](errors.md#badgatewayerror) + +### BadRequestError + +Re-exports [BadRequestError](errors.md#badrequesterror) + +### caseInsensitiveSort + +Re-exports [caseInsensitiveSort](array.md#caseinsensitivesort) + +### clean + +Re-exports [clean](objects.md#clean) + +### CliBackground + +Re-exports [CliBackground](logger.md#clibackground) + +### CliEffects + +Re-exports [CliEffects](logger.md#clieffects) + +### CliForeground + +Re-exports [CliForeground](logger.md#cliforeground) + +### CustomError + +Re-exports [CustomError](errors.md#customerror) + +### dec2Frac + +Re-exports [dec2Frac](math.md#dec2frac) + +### DecodedResponse + +Re-exports [DecodedResponse](http.md#decodedresponset) + +### deepCopy + +Re-exports [deepCopy](objects.md#deepcopy) + +### deepMerge + +Re-exports [deepMerge](objects.md#deepmerge) + +### dotNotation + +Re-exports [dotNotation](objects.md#dotnotation) + +### download + +Re-exports [download](files.md#download) + +### downloadBlob + +Re-exports [downloadBlob](files.md#downloadblob) + +### encodeQuery + +Re-exports [encodeQuery](objects.md#encodequery) + +### errorFromCode + +Re-exports [errorFromCode](errors.md#errorfromcode) + +### fileBrowser + +Re-exports [fileBrowser](files.md#filebrowser) + +### findByProp + +Re-exports [findByProp](array.md#findbyprop) + +### flattenArr + +Re-exports [flattenArr](array.md#flattenarr) + +### flattenObj + +Re-exports [flattenObj](objects.md#flattenobj) + +### ForbiddenError + +Re-exports [ForbiddenError](errors.md#forbiddenerror) + +### formatBytes + +Re-exports [formatBytes](string.md#formatbytes) + +### formatDate + +Re-exports [formatDate](time.md#formatdate) + +### formatPhoneNumber + +Re-exports [formatPhoneNumber](string.md#formatphonenumber) + +### formData + +Re-exports [formData](objects.md#formdata) + +### fracToDec + +Re-exports [fracToDec](math.md#fractodec) + +### GatewayTimeoutError + +Re-exports [GatewayTimeoutError](errors.md#gatewaytimeouterror) + +### gravatar + +Re-exports [gravatar](misc.md#gravatar) + +### Http + +Re-exports [Http](http.md#http) + +### HttpDefaults + +Re-exports [HttpDefaults](http.md#httpdefaults) + +### HttpInterceptor + +Re-exports [HttpInterceptor](http.md#httpinterceptor) + +### HttpRequestOptions + +Re-exports [HttpRequestOptions](http.md#httprequestoptions) + +### includes + +Re-exports [includes](objects.md#includes) + +### insertAt + +Re-exports [insertAt](string.md#insertat) + +### InternalServerError + +Re-exports [InternalServerError](errors.md#internalservererror) + +### isEqual + +Re-exports [isEqual](objects.md#isequal) + +### JSONAttemptParse + +Re-exports [JSONAttemptParse](objects.md#jsonattemptparse) + +### JSONSanitize + +Re-exports [JSONSanitize](objects.md#jsonsanitize) + +### Listener + +Re-exports [Listener](emitter.md#listener) + +### LOG\_LEVEL + +Re-exports [LOG_LEVEL](logger.md#log_level) + +### Logger + +Re-exports [Logger](logger.md#logger) + +### LoggerEvents + +Re-exports [LoggerEvents](logger.md#loggerevents) + +### makeArray + +Re-exports [makeArray](array.md#makearray) + +### makeUnique + +Re-exports [makeUnique](array.md#makeunique) + +### matchAll + +Re-exports [matchAll](string.md#matchall) + +### md5 + +Re-exports [md5](string.md#md5) + +### MethodNotAllowedError + +Re-exports [MethodNotAllowedError](errors.md#methodnotallowederror) + +### mixin + +Re-exports [mixin](objects.md#mixin) + +### NotAcceptableError + +Re-exports [NotAcceptableError](errors.md#notacceptableerror) + +### NotFoundError + +Re-exports [NotFoundError](errors.md#notfounderror) + +### NotImplementedError + +Re-exports [NotImplementedError](errors.md#notimplementederror) + +### pad + +Re-exports [pad](string.md#pad) + +### ParsedUrl + +Re-exports [ParsedUrl](string.md#parsedurl) + +### parseUrl + +Re-exports [parseUrl](string.md#parseurl) + +### PaymentRequiredError + +Re-exports [PaymentRequiredError](errors.md#paymentrequirederror) + +### ProgressCallback + +Re-exports [ProgressCallback](promise-progress.md#progresscallback) + +### PromiseProgress + +Re-exports [PromiseProgress](promise-progress.md#promiseprogresst) + +### randomHex + +Re-exports [randomHex](string.md#randomhex) + +### randomString + +Re-exports [randomString](string.md#randomstring) + +### randomStringBuilder + +Re-exports [randomStringBuilder](string.md#randomstringbuilder) + +### ServiceUnavailableError + +Re-exports [ServiceUnavailableError](errors.md#serviceunavailableerror) + +### sleep + +Re-exports [sleep](time.md#sleep) + +### sleepUntil + +Re-exports [sleepUntil](time.md#sleepuntil) + +### sortByProp + +Re-exports [sortByProp](array.md#sortbyprop) + +### timestampFilename + +Re-exports [timestampFilename](files.md#timestampfilename) + +### timeUntil + +Re-exports [timeUntil](time.md#timeuntil) + +### tyoeKeys + +Re-exports [tyoeKeys](types.md#tyoekeys) + +### TypedEmitter + +Re-exports [TypedEmitter](emitter.md#typedemittert) + +### TypedEvents + +Re-exports [TypedEvents](emitter.md#typedevents) + +### UnauthorizedError + +Re-exports [UnauthorizedError](errors.md#unauthorizederror) + +### uploadWithProgress + +Re-exports [uploadWithProgress](files.md#uploadwithprogress) + +### validateEmail + +Re-exports [validateEmail](string.md#validateemail) diff --git a/logger.md b/logger.md new file mode 100644 index 0000000..da07d07 --- /dev/null +++ b/logger.md @@ -0,0 +1,615 @@ +[@ztimson/utils](Home.md) / logger + +# logger + +## Enumerations + +### LOG\_LEVEL + +#### Enumeration Members + +##### DEBUG + +> **DEBUG**: `4` + +###### Defined in + +src/logger.ts:49 + +##### ERROR + +> **ERROR**: `0` + +###### Defined in + +src/logger.ts:45 + +##### INFO + +> **INFO**: `2` + +###### Defined in + +src/logger.ts:47 + +##### LOG + +> **LOG**: `3` + +###### Defined in + +src/logger.ts:48 + +##### WARN + +> **WARN**: `1` + +###### Defined in + +src/logger.ts:46 + +## Classes + +### Logger + +#### Extends + +- [`TypedEmitter`](emitter.md#typedemittert)\<[`LoggerEvents`](logger.md#loggerevents)\> + +#### Constructors + +##### new Logger() + +> **new Logger**(`namespace`?): [`Logger`](logger.md#logger) + +###### Parameters + +• **namespace?**: `string` + +###### Returns + +[`Logger`](logger.md#logger) + +###### Overrides + +[`TypedEmitter`](emitter.md#typedemittert).[`constructor`](emitter.md#constructors) + +###### Defined in + +src/logger.ts:63 + +#### Properties + +##### namespace? + +> `readonly` `optional` **namespace**: `string` + +###### Defined in + +src/logger.ts:63 + +##### LOG\_LEVEL + +> `static` **LOG\_LEVEL**: [`LOG_LEVEL`](logger.md#log_level) = `LOG_LEVEL.DEBUG` + +###### Defined in + +src/logger.ts:61 + +#### Methods + +##### debug() + +> **debug**(...`args`): `void` + +###### Parameters + +• ...**args**: `string`[] + +###### Returns + +`void` + +###### Defined in + +src/logger.ts:81 + +##### emit() + +> **emit**\<`K`\>(`event`, ...`args`): `void` + +###### Type Parameters + +• **K** *extends* `string` \| `symbol` + +###### Parameters + +• **event**: `K` + +• ...**args**: `Parameters`\<[`LoggerEvents`](logger.md#loggerevents)\[`K`\]\> + +###### Returns + +`void` + +###### Inherited from + +[`TypedEmitter`](emitter.md#typedemittert).[`emit`](emitter.md#emit) + +###### Defined in + +src/emitter.ts:36 + +##### error() + +> **error**(...`args`): `void` + +###### Parameters + +• ...**args**: `string`[] + +###### Returns + +`void` + +###### Defined in + +src/logger.ts:109 + +##### info() + +> **info**(...`args`): `void` + +###### Parameters + +• ...**args**: `string`[] + +###### Returns + +`void` + +###### Defined in + +src/logger.ts:95 + +##### log() + +> **log**(...`args`): `void` + +###### Parameters + +• ...**args**: `string`[] + +###### Returns + +`void` + +###### Defined in + +src/logger.ts:88 + +##### off() + +> **off**\<`K`\>(`event`, `listener`): `void` + +###### Type Parameters + +• **K** *extends* `string` \| `symbol` = `string` + +###### Parameters + +• **event**: `K` + +• **listener**: [`LoggerEvents`](logger.md#loggerevents)\[`K`\] + +###### Returns + +`void` + +###### Inherited from + +[`TypedEmitter`](emitter.md#typedemittert).[`off`](emitter.md#off) + +###### Defined in + +src/emitter.ts:41 + +##### on() + +> **on**\<`K`\>(`event`, `listener`): () => `void` + +###### Type Parameters + +• **K** *extends* `string` \| `symbol` = `string` + +###### Parameters + +• **event**: `K` + +• **listener**: [`LoggerEvents`](logger.md#loggerevents)\[`K`\] + +###### Returns + +`Function` + +###### Returns + +`void` + +###### Inherited from + +[`TypedEmitter`](emitter.md#typedemittert).[`on`](emitter.md#on) + +###### Defined in + +src/emitter.ts:45 + +##### once() + +> **once**\<`K`\>(`event`, `listener`?): `Promise`\<`any`\> + +###### Type Parameters + +• **K** *extends* `string` \| `symbol` = `string` + +###### Parameters + +• **event**: `K` + +• **listener?**: [`LoggerEvents`](logger.md#loggerevents)\[`K`\] + +###### Returns + +`Promise`\<`any`\> + +###### Inherited from + +[`TypedEmitter`](emitter.md#typedemittert).[`once`](emitter.md#once) + +###### Defined in + +src/emitter.ts:51 + +##### warn() + +> **warn**(...`args`): `void` + +###### Parameters + +• ...**args**: `string`[] + +###### Returns + +`void` + +###### Defined in + +src/logger.ts:102 + +##### emit() + +> `static` **emit**(`event`, ...`args`): `void` + +###### Parameters + +• **event**: `any` + +• ...**args**: `any`[] + +###### Returns + +`void` + +###### Inherited from + +[`TypedEmitter`](emitter.md#typedemittert).[`emit`](emitter.md#emit-1) + +###### Defined in + +src/emitter.ts:9 + +##### off() + +> `static` **off**(`event`, `listener`): `void` + +###### Parameters + +• **event**: `any` + +• **listener**: [`Listener`](emitter.md#listener) + +###### Returns + +`void` + +###### Inherited from + +[`TypedEmitter`](emitter.md#typedemittert).[`off`](emitter.md#off-1) + +###### Defined in + +src/emitter.ts:14 + +##### on() + +> `static` **on**(`event`, `listener`): () => `void` + +###### Parameters + +• **event**: `any` + +• **listener**: [`Listener`](emitter.md#listener) + +###### Returns + +`Function` + +###### Returns + +`void` + +###### Inherited from + +[`TypedEmitter`](emitter.md#typedemittert).[`on`](emitter.md#on-1) + +###### Defined in + +src/emitter.ts:19 + +##### once() + +> `static` **once**(`event`, `listener`?): `Promise`\<`any`\> + +###### Parameters + +• **event**: `any` + +• **listener?**: [`Listener`](emitter.md#listener) + +###### Returns + +`Promise`\<`any`\> + +###### Inherited from + +[`TypedEmitter`](emitter.md#typedemittert).[`once`](emitter.md#once-1) + +###### Defined in + +src/emitter.ts:26 + +## Type Aliases + +### LoggerEvents + +> **LoggerEvents**: [`TypedEvents`](emitter.md#typedevents) & `object` + +#### Type declaration + +##### DEBUG() + +> **DEBUG**: (...`args`) => `any` + +###### Parameters + +• ...**args**: `any`[] + +###### Returns + +`any` + +##### ERROR() + +> **ERROR**: (...`args`) => `any` + +###### Parameters + +• ...**args**: `any`[] + +###### Returns + +`any` + +##### INFO() + +> **INFO**: (...`args`) => `any` + +###### Parameters + +• ...**args**: `any`[] + +###### Returns + +`any` + +##### LOG() + +> **LOG**: (...`args`) => `any` + +###### Parameters + +• ...**args**: `any`[] + +###### Returns + +`any` + +##### WARN() + +> **WARN**: (...`args`) => `any` + +###### Parameters + +• ...**args**: `any`[] + +###### Returns + +`any` + +#### Defined in + +src/logger.ts:52 + +## Variables + +### CliBackground + +> `const` **CliBackground**: `object` + +#### Type declaration + +##### BLACK + +> **BLACK**: `string` = `"\x1b[40m"` + +##### BLUE + +> **BLUE**: `string` = `"\x1b[44m"` + +##### CYAN + +> **CYAN**: `string` = `"\x1b[46m"` + +##### GREEN + +> **GREEN**: `string` = `"\x1b[42m"` + +##### GREY + +> **GREY**: `string` = `"\x1b[100m"` + +##### MAGENTA + +> **MAGENTA**: `string` = `"\x1b[45m"` + +##### RED + +> **RED**: `string` = `"\x1b[41m"` + +##### WHITE + +> **WHITE**: `string` = `"\x1b[47m"` + +##### YELLOW + +> **YELLOW**: `string` = `"\x1b[43m"` + +#### Defined in + +src/logger.ts:32 + +*** + +### CliEffects + +> `const` **CliEffects**: `object` + +#### Type declaration + +##### BLINK + +> **BLINK**: `string` = `"\x1b[5m"` + +##### BRIGHT + +> **BRIGHT**: `string` = `"\x1b[1m"` + +##### CLEAR + +> **CLEAR**: `string` = `"\x1b[0m"` + +##### DIM + +> **DIM**: `string` = `"\x1b[2m"` + +##### HIDDEN + +> **HIDDEN**: `string` = `"\x1b[8m"` + +##### REVERSE + +> **REVERSE**: `string` = `"\x1b[7m"` + +##### UNDERSCORE + +> **UNDERSCORE**: `string` = `"\x1b[4m"` + +#### Defined in + +src/logger.ts:3 + +*** + +### CliForeground + +> `const` **CliForeground**: `object` + +#### Type declaration + +##### BLACK + +> **BLACK**: `string` = `'\x1b[30m'` + +##### BLUE + +> **BLUE**: `string` = `'\x1b[34m'` + +##### CYAN + +> **CYAN**: `string` = `'\x1b[36m'` + +##### GREEN + +> **GREEN**: `string` = `'\x1b[32m'` + +##### GREY + +> **GREY**: `string` = `'\x1b[90m'` + +##### LIGHT\_BLUE + +> **LIGHT\_BLUE**: `string` = `'\x1b[94m'` + +##### LIGHT\_CYAN + +> **LIGHT\_CYAN**: `string` = `'\x1b[96m'` + +##### LIGHT\_GREEN + +> **LIGHT\_GREEN**: `string` = `'\x1b[92m'` + +##### LIGHT\_GREY + +> **LIGHT\_GREY**: `string` = `'\x1b[37m'` + +##### LIGHT\_MAGENTA + +> **LIGHT\_MAGENTA**: `string` = `'\x1b[95m'` + +##### LIGHT\_RED + +> **LIGHT\_RED**: `string` = `'\x1b[91m'` + +##### LIGHT\_YELLOW + +> **LIGHT\_YELLOW**: `string` = `'\x1b[93m'` + +##### MAGENTA + +> **MAGENTA**: `string` = `'\x1b[35m'` + +##### RED + +> **RED**: `string` = `'\x1b[31m'` + +##### WHITE + +> **WHITE**: `string` = `'\x1b[97m'` + +##### YELLOW + +> **YELLOW**: `string` = `'\x1b[33m'` + +#### Defined in + +src/logger.ts:13 diff --git a/math.md b/math.md new file mode 100644 index 0000000..dcd04be --- /dev/null +++ b/math.md @@ -0,0 +1,63 @@ +[@ztimson/utils](Home.md) / math + +# math + +## Functions + +### dec2Frac() + +> **dec2Frac**(`num`): `string` + +Convert decimal number to fraction + +#### Parameters + +• **num**: `number` + +Number to convert + +#### Returns + +`string` + +Fraction with remainder + +#### Example + +```js +dec2Frac(1.25) // Outputs: "1 1/4" +``` + +#### Defined in + +src/math.ts:12 + +*** + +### fracToDec() + +> **fracToDec**(`frac`): `number` + +Convert fraction to decimal number + +#### Parameters + +• **frac**: `string` + +Fraction to convert + +#### Returns + +`number` + +Faction as a decimal + +#### Example + +```js +fracToDec('1 1/4') // Outputs: 1.25 +``` + +#### Defined in + +src/math.ts:40 diff --git a/misc.md b/misc.md new file mode 100644 index 0000000..82b2ce6 --- /dev/null +++ b/misc.md @@ -0,0 +1,31 @@ +[@ztimson/utils](Home.md) / misc + +# misc + +## Functions + +### gravatar() + +> **gravatar**(`email`, `def`): `string` + +Get profile image from Gravatar + +#### Parameters + +• **email**: `string` + +Account email address + +• **def**: `string` = `'mp'` + +Default image, can be a link or '404', see: https://docs.gravatar.com/general/images/ + +#### Returns + +`string` + +Gravatar URL + +#### Defined in + +src/misc.ts:10 diff --git a/objects.md b/objects.md new file mode 100644 index 0000000..0a2e8dc --- /dev/null +++ b/objects.md @@ -0,0 +1,422 @@ +[@ztimson/utils](Home.md) / objects + +# objects + +## Functions + +### clean() + +> **clean**\<`T`\>(`obj`, `undefinedOnly`): `Partial`\<`T`\> + +Removes any null values from an object in-place + +#### Type Parameters + +• **T** + +#### Parameters + +• **obj**: `T` + +Object reference that will be cleaned + +• **undefinedOnly**: `boolean` = `false` + +Ignore null values + +#### Returns + +`Partial`\<`T`\> + +Cleaned object + +#### Example + +```ts +let test = {a: 0, b: false, c: null, d: 'abc'} +console.log(clean(test)); // Output: {a: 0, b: false, d: 'abc'} +``` + +#### Defined in + +src/objects.ts:14 + +*** + +### ~~deepCopy()~~ + +> **deepCopy**\<`T`\>(`value`): `T` + +Create a deep copy of an object (vs. a shallow copy of references) + +Should be replaced by `structuredClone` once released. + +#### Type Parameters + +• **T** + +#### Parameters + +• **value**: `T` + +Object to copy + +#### Returns + +`T` + +Type + +#### Deprecated + +Please use `structuredClone` + +#### Defined in + +src/objects.ts:34 + +*** + +### deepMerge() + +> **deepMerge**\<`T`\>(`target`, ...`sources`): `T` + +Merge any number of objects into the target + +#### Type Parameters + +• **T** + +#### Parameters + +• **target**: `any` + +Destination of all properties + +• ...**sources**: `any`[] + +Objects that will copied into target + +#### Returns + +`T` + +The des + +#### Defined in + +src/objects.ts:45 + +*** + +### dotNotation() + +#### dotNotation(obj, prop, set) + +> **dotNotation**\<`T`\>(`obj`, `prop`, `set`): `T` + +Get/set a property of an object using dot notation + +##### Type Parameters + +• **T** + +##### Parameters + +• **obj**: `any` + +source object to search + +• **prop**: `string` + +property name (Dot notation & indexing allowed) + +• **set**: `T` + +Set object property to value, omit to fetch value instead + +##### Returns + +`T` + +property value + +##### Example + +```ts +// Get a value +const name = dotNotation(person, 'firstName'); +const familyCarMake = dotNotation(family, 'cars[0].make'); +// Set a value +dotNotation(family, 'cars[0].make', 'toyota'); +``` + +##### Defined in + +src/objects.ts:77 + +#### dotNotation(obj, prop) + +> **dotNotation**\<`T`\>(`obj`, `prop`): `T` \| `undefined` + +##### Type Parameters + +• **T** + +##### Parameters + +• **obj**: `any` + +• **prop**: `string` + +##### Returns + +`T` \| `undefined` + +##### Defined in + +src/objects.ts:78 + +*** + +### encodeQuery() + +> **encodeQuery**(`data`): `string` + +Convert object into URL encoded query string + +#### Parameters + +• **data**: `any` + +data to convert + +#### Returns + +`string` + +- Encoded form data + +#### Example + +```js +const query = encodeQuery({page: 1, size: 20}); +console.log(query); // Output: "page=1&size=20" +``` + +#### Defined in + +src/objects.ts:107 + +*** + +### flattenObj() + +> **flattenObj**(`obj`, `parent`?, `result`?): `any` + +Recursively flatten a nested object, while maintaining key structure + +#### Parameters + +• **obj**: `any` + +Object to flatten + +• **parent?**: `any` + +Recursively check if key is a parent key or not + +• **result?**: `any` = `{}` + +Result + +#### Returns + +`any` + +- Flattened object + +#### Example + +```ts +const car = {honda: {model: "Civic"}}; +console.log(flattenObj(car)); //Output {honda.model: "Civic"} +``` + +#### Defined in + +src/objects.ts:128 + +*** + +### formData() + +> **formData**(`target`): `FormData` + +Convert object to FormData + +#### Parameters + +• **target**: `any` + +Object to convert + +#### Returns + +`FormData` + +- Form object + +#### Defined in + +src/objects.ts:148 + +*** + +### includes() + +> **includes**(`target`, `values`, `allowMissing`): `boolean` + +Check that an object has the following values + +#### Parameters + +• **target**: `any` + +Object to search + +• **values**: `any` + +Criteria to check against + +• **allowMissing**: `boolean` = `false` + +Only check the keys that are available on the target + +#### Returns + +`boolean` + +Does target include all the values + +#### Example + +```ts +const test = {a: 2, b: 2}; +includes(test, {a: 1}); // true +includes(test, {b: 1, c: 3}); // false +``` + +#### Defined in + +src/objects.ts:169 + +*** + +### isEqual() + +> **isEqual**(`a`, `b`): `boolean` + +Deep check if two objects are equal + +#### Parameters + +• **a**: `any` + +first item to compare + +• **b**: `any` + +second item to compare + +#### Returns + +`boolean` + +True if they match + +#### Defined in + +src/objects.ts:188 + +*** + +### JSONAttemptParse() + +> **JSONAttemptParse**\<`T`\>(`json`): `T` \| `string` + +Parse JSON but return the original string if it fails + +#### Type Parameters + +• **T** + +#### Parameters + +• **json**: `string` + +JSON string to parse + +#### Returns + +`T` \| `string` + +Object if successful, original string otherwise + +#### Defined in + +src/objects.ts:222 + +*** + +### JSONSanitize() + +> **JSONSanitize**(`obj`, `space`?): `string` + +Convert an object to a JSON string avoiding any circular references. + +#### Parameters + +• **obj**: `any` + +Object to convert to JSON + +• **space?**: `number` + +Format the JSON with spaces + +#### Returns + +`string` + +JSON string + +#### Defined in + +src/objects.ts:234 + +*** + +### mixin() + +> **mixin**(`target`, `constructors`): `void` + +Experimental: Combine multiple object prototypes into one + +#### Parameters + +• **target**: `any` + +Object that will have prototypes added + +• **constructors**: `any`[] + +Additionally prototypes that should be merged into target + +#### Returns + +`void` + +#### Defined in + +src/objects.ts:203 diff --git a/promise-progress.md b/promise-progress.md new file mode 100644 index 0000000..93d1422 --- /dev/null +++ b/promise-progress.md @@ -0,0 +1,600 @@ +[@ztimson/utils](Home.md) / promise-progress + +# promise-progress + +## Classes + +### PromiseProgress\ + +A promise that fires the `onProgress` callback on incremental progress + +#### Example + +```js +const promise = new Promise((resolve, reject, progress) => { + const max = 10; + for(let i = 0; i < max; i++) progress(i / max); + resolve(1); +}); + +console.log(promise.progress); + +promise.onProgress(console.log) + .then(console.log) + .catch(console.error) + .finally(...); + +``` + +#### Extends + +- `Promise`\<`T`\> + +#### Type Parameters + +• **T** + +#### Constructors + +##### new PromiseProgress() + +> **new PromiseProgress**\<`T`\>(`executor`): [`PromiseProgress`](promise-progress.md#promiseprogresst)\<`T`\> + +###### Parameters + +• **executor** + +###### Returns + +[`PromiseProgress`](promise-progress.md#promiseprogresst)\<`T`\> + +###### Overrides + +`Promise.constructor` + +###### Defined in + +src/promise-progress.ts:34 + +#### Properties + +##### \[toStringTag\] + +> `readonly` **\[toStringTag\]**: `string` + +###### Inherited from + +`Promise.[toStringTag]` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:176 + +##### \[species\] + +> `readonly` `static` **\[species\]**: `PromiseConstructor` + +###### Inherited from + +`Promise.[species]` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:180 + +#### Accessors + +##### progress + +> `get` **progress**(): `number` + +> `set` **progress**(`p`): `void` + +###### Parameters + +• **p**: `number` + +###### Returns + +`number` + +###### Defined in + +src/promise-progress.ts:27 + +#### Methods + +##### catch() + +> **catch**(`rej`?): [`PromiseProgress`](promise-progress.md#promiseprogresst)\<`any`\> + +Attaches a callback for only the rejection of the Promise. + +###### Parameters + +• **rej?** + +###### Returns + +[`PromiseProgress`](promise-progress.md#promiseprogresst)\<`any`\> + +A Promise for the completion of the callback. + +###### Overrides + +`Promise.catch` + +###### Defined in + +src/promise-progress.ts:65 + +##### finally() + +> **finally**(`res`?): [`PromiseProgress`](promise-progress.md#promiseprogresst)\<`any`\> + +Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The +resolved value cannot be modified from the callback. + +###### Parameters + +• **res?** + +###### Returns + +[`PromiseProgress`](promise-progress.md#promiseprogresst)\<`any`\> + +A Promise for the completion of the callback. + +###### Overrides + +`Promise.finally` + +###### Defined in + +src/promise-progress.ts:69 + +##### onProgress() + +> **onProgress**(`callback`): [`PromiseProgress`](promise-progress.md#promiseprogresst)\<`T`\> + +###### Parameters + +• **callback**: [`ProgressCallback`](promise-progress.md#progresscallback) + +###### Returns + +[`PromiseProgress`](promise-progress.md#promiseprogresst)\<`T`\> + +###### Defined in + +src/promise-progress.ts:55 + +##### then() + +> **then**(`res`?, `rej`?): [`PromiseProgress`](promise-progress.md#promiseprogresst)\<`any`\> + +Attaches callbacks for the resolution and/or rejection of the Promise. + +###### Parameters + +• **res?** + +• **rej?** + +###### Returns + +[`PromiseProgress`](promise-progress.md#promiseprogresst)\<`any`\> + +A Promise for the completion of which ever callback is executed. + +###### Overrides + +`Promise.then` + +###### Defined in + +src/promise-progress.ts:60 + +##### all() + +###### all(values) + +> `static` **all**\<`T`\>(`values`): `Promise`\<`Awaited`\<`T`\>[]\> + +Creates a Promise that is resolved with an array of results when all of the provided Promises +resolve, or rejected when any Promise is rejected. + +###### Type Parameters + +• **T** + +###### Parameters + +• **values**: `Iterable`\<`T` \| `PromiseLike`\<`T`\>\> + +An iterable of Promises. + +###### Returns + +`Promise`\<`Awaited`\<`T`\>[]\> + +A new Promise. + +###### Inherited from + +`Promise.all` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.iterable.d.ts:225 + +###### all(values) + +> `static` **all**\<`T`\>(`values`): `Promise`\<\{ -readonly \[P in string \| number \| symbol\]: Awaited\\]\> \}\> + +Creates a Promise that is resolved with an array of results when all of the provided Promises +resolve, or rejected when any Promise is rejected. + +###### Type Parameters + +• **T** *extends* readonly `unknown`[] \| [] + +###### Parameters + +• **values**: `T` + +An array of Promises. + +###### Returns + +`Promise`\<\{ -readonly \[P in string \| number \| symbol\]: Awaited\\]\> \}\> + +A new Promise. + +###### Inherited from + +`Promise.all` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.promise.d.ts:39 + +##### allSettled() + +###### allSettled(values) + +> `static` **allSettled**\<`T`\>(`values`): `Promise`\<\{ -readonly \[P in string \| number \| symbol\]: PromiseSettledResult\\]\>\> \}\> + +Creates a Promise that is resolved with an array of results when all +of the provided Promises resolve or reject. + +###### Type Parameters + +• **T** *extends* readonly `unknown`[] \| [] + +###### Parameters + +• **values**: `T` + +An array of Promises. + +###### Returns + +`Promise`\<\{ -readonly \[P in string \| number \| symbol\]: PromiseSettledResult\\]\>\> \}\> + +A new Promise. + +###### Inherited from + +`Promise.allSettled` + +###### Defined in + +node\_modules/typescript/lib/lib.es2020.promise.d.ts:38 + +###### allSettled(values) + +> `static` **allSettled**\<`T`\>(`values`): `Promise`\<`PromiseSettledResult`\<`Awaited`\<`T`\>\>[]\> + +Creates a Promise that is resolved with an array of results when all +of the provided Promises resolve or reject. + +###### Type Parameters + +• **T** + +###### Parameters + +• **values**: `Iterable`\<`T` \| `PromiseLike`\<`T`\>\> + +An array of Promises. + +###### Returns + +`Promise`\<`PromiseSettledResult`\<`Awaited`\<`T`\>\>[]\> + +A new Promise. + +###### Inherited from + +`Promise.allSettled` + +###### Defined in + +node\_modules/typescript/lib/lib.es2020.promise.d.ts:46 + +##### any() + +###### any(values) + +> `static` **any**\<`T`\>(`values`): `Promise`\<`Awaited`\<`T`\[`number`\]\>\> + +The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm. + +###### Type Parameters + +• **T** *extends* readonly `unknown`[] \| [] + +###### Parameters + +• **values**: `T` + +An array or iterable of Promises. + +###### Returns + +`Promise`\<`Awaited`\<`T`\[`number`\]\>\> + +A new Promise. + +###### Inherited from + +`Promise.any` + +###### Defined in + +node\_modules/typescript/lib/lib.es2021.promise.d.ts:40 + +###### any(values) + +> `static` **any**\<`T`\>(`values`): `Promise`\<`Awaited`\<`T`\>\> + +The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm. + +###### Type Parameters + +• **T** + +###### Parameters + +• **values**: `Iterable`\<`T` \| `PromiseLike`\<`T`\>\> + +An array or iterable of Promises. + +###### Returns + +`Promise`\<`Awaited`\<`T`\>\> + +A new Promise. + +###### Inherited from + +`Promise.any` + +###### Defined in + +node\_modules/typescript/lib/lib.es2021.promise.d.ts:47 + +##### from() + +> `static` **from**\<`T`\>(`promise`): [`PromiseProgress`](promise-progress.md#promiseprogresst)\<`T`\> + +###### Type Parameters + +• **T** + +###### Parameters + +• **promise**: `Promise`\<`T`\> + +###### Returns + +[`PromiseProgress`](promise-progress.md#promiseprogresst)\<`T`\> + +###### Defined in + +src/promise-progress.ts:42 + +##### race() + +###### race(values) + +> `static` **race**\<`T`\>(`values`): `Promise`\<`Awaited`\<`T`\>\> + +Creates a Promise that is resolved or rejected when any of the provided Promises are resolved +or rejected. + +###### Type Parameters + +• **T** + +###### Parameters + +• **values**: `Iterable`\<`T` \| `PromiseLike`\<`T`\>\> + +An iterable of Promises. + +###### Returns + +`Promise`\<`Awaited`\<`T`\>\> + +A new Promise. + +###### Inherited from + +`Promise.race` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.iterable.d.ts:233 + +###### race(values) + +> `static` **race**\<`T`\>(`values`): `Promise`\<`Awaited`\<`T`\[`number`\]\>\> + +Creates a Promise that is resolved or rejected when any of the provided Promises are resolved +or rejected. + +###### Type Parameters + +• **T** *extends* readonly `unknown`[] \| [] + +###### Parameters + +• **values**: `T` + +An array of Promises. + +###### Returns + +`Promise`\<`Awaited`\<`T`\[`number`\]\>\> + +A new Promise. + +###### Inherited from + +`Promise.race` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.promise.d.ts:50 + +##### reject() + +> `static` **reject**\<`T`\>(`reason`?): `Promise`\<`T`\> + +Creates a new rejected promise for the provided reason. + +###### Type Parameters + +• **T** = `never` + +###### Parameters + +• **reason?**: `any` + +The reason the promise was rejected. + +###### Returns + +`Promise`\<`T`\> + +A new rejected Promise. + +###### Inherited from + +`Promise.reject` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.promise.d.ts:60 + +##### resolve() + +###### resolve() + +> `static` **resolve**(): `Promise`\<`void`\> + +Creates a new resolved promise. + +###### Returns + +`Promise`\<`void`\> + +A resolved promise. + +###### Inherited from + +`Promise.resolve` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.promise.d.ts:66 + +###### resolve(value) + +> `static` **resolve**\<`T`\>(`value`): `Promise`\<`Awaited`\<`T`\>\> + +Creates a new resolved promise for the provided value. + +###### Type Parameters + +• **T** + +###### Parameters + +• **value**: `T` + +A promise. + +###### Returns + +`Promise`\<`Awaited`\<`T`\>\> + +A promise whose internal state matches the provided promise. + +###### Inherited from + +`Promise.resolve` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.promise.d.ts:72 + +###### resolve(value) + +> `static` **resolve**\<`T`\>(`value`): `Promise`\<`Awaited`\<`T`\>\> + +Creates a new resolved promise for the provided value. + +###### Type Parameters + +• **T** + +###### Parameters + +• **value**: `T` \| `PromiseLike`\<`T`\> + +A promise. + +###### Returns + +`Promise`\<`Awaited`\<`T`\>\> + +A promise whose internal state matches the provided promise. + +###### Inherited from + +`Promise.resolve` + +###### Defined in + +node\_modules/typescript/lib/lib.es2015.promise.d.ts:78 + +## Type Aliases + +### ProgressCallback() + +> **ProgressCallback**: (`progress`) => `any` + +#### Parameters + +• **progress**: `number` + +#### Returns + +`any` + +#### Defined in + +src/promise-progress.ts:1 diff --git a/string.md b/string.md new file mode 100644 index 0000000..22d9150 --- /dev/null +++ b/string.md @@ -0,0 +1,396 @@ +[@ztimson/utils](Home.md) / string + +# string + +## Type Aliases + +### ParsedUrl + +> **ParsedUrl**: `object` + +Parts of a URL + +#### Type declaration + +##### domain + +> **domain**: `string` + +##### fragment? + +> `optional` **fragment**: `string` + +##### host + +> **host**: `string` + +##### path? + +> `optional` **path**: `string` + +##### port? + +> `optional` **port**: `number` + +##### protocol? + +> `optional` **protocol**: `string` + +##### query? + +> `optional` **query**: `object` + +###### Index Signature + + \[`name`: `string`\]: `string` + +##### subdomain? + +> `optional` **subdomain**: `string` + +#### Defined in + +src/string.ts:180 + +## Functions + +### formatBytes() + +> **formatBytes**(`bytes`, `decimals`): `string` + +Convert number of bytes into a human-readable size + +#### Parameters + +• **bytes**: `number` + +Number of bytes + +• **decimals**: `number` = `2` + +Decimal places to preserve + +#### Returns + +`string` + +Formated size + +#### Defined in + +src/string.ts:38 + +*** + +### formatPhoneNumber() + +> **formatPhoneNumber**(`number`): `string` + +Extract numbers from a string & create a formated phone number: +1 (123) 456-7890 + +#### Parameters + +• **number**: `string` + +String that will be parsed for numbers + +#### Returns + +`string` + +Formated phone number + +#### Defined in + +src/string.ts:52 + +*** + +### insertAt() + +> **insertAt**(`target`, `str`, `index`): `String` + +Insert a string into another string at a given position + +#### Parameters + +• **target**: `string` + +Parent string you want to modify + +• **str**: `string` + +Value that will be injected to parent + +• **index**: `number` + +Position to inject string at + +#### Returns + +`String` + +- New string + +#### Example + +```js +console.log(insertAt('Hello world!', ' glorious', 5); +// Output: Hello glorious world! +``` + +#### Defined in + +src/string.ts:72 + +*** + +### matchAll() + +> **matchAll**(`value`, `regex`): `RegExpExecArray`[] + +Find all substrings that match a given pattern. + +Roughly based on `String.prototype.matchAll`. + +#### Parameters + +• **value**: `string` + +String to search. + +• **regex**: `string` \| `RegExp` + +Regular expression to match. + +#### Returns + +`RegExpExecArray`[] + +Found matches. + +#### Defined in + +src/string.ts:160 + +*** + +### md5() + +> **md5**(`d`): `string` + +Create MD5 hash using native javascript + +#### Parameters + +• **d**: `string` + +String to hash + +#### Returns + +`string` + +Hashed string + +#### Defined in + +src/string.ts:226 + +*** + +### ~~pad()~~ + +> **pad**(`text`, `length`, `char`, `start`): `any` + +Add padding to string + +#### Parameters + +• **text**: `any` + +Text that will be padded + +• **length**: `number` + +Target length + +• **char**: `string` = `' '` + +Character to use as padding, defaults to space + +• **start**: `boolean` = `true` + +Will pad start of text if true, or the end if false + +#### Returns + +`any` + +Padded string + +#### Example + +```js +const now = new Date(); +const padded = now.getHours() + ':' + pad(now.getMinutes(), 2, '0'); +console.log(padded); // Output: "2:05" +``` + +#### Deprecated + +Please use `String.padStart` & `String.padEnd` + +#### Defined in + +src/string.ts:93 + +*** + +### parseUrl() + +> **parseUrl**(`url`): [`ParsedUrl`](string.md#parsedurl) + +Break a URL string into its parts for easy parsing + +#### Parameters + +• **url**: `string` + +URL string that will be parsed + +#### Returns + +[`ParsedUrl`](string.md#parsedurl) + +Parts of URL + +#### Defined in + +src/string.ts:197 + +*** + +### randomHex() + +> **randomHex**(`length`): `string` + +Generate a random hexadecimal value + +#### Parameters + +• **length**: `number` + +Number of hexadecimal place values + +#### Returns + +`string` + +Hexadecimal number as a string + +#### Defined in + +src/string.ts:27 + +*** + +### randomString() + +> **randomString**(`length`, `pool`): `string` + +Generate a string of random characters. + +#### Parameters + +• **length**: `number` + +length of generated string + +• **pool**: `string` = `CHAR_LIST` + +character pool to generate string from + +#### Returns + +`string` + +generated string + +#### Example + +```ts +const random = randomString(); +const randomByte = randomString(8, "01") +``` + +#### Defined in + +src/string.ts:111 + +*** + +### randomStringBuilder() + +> **randomStringBuilder**(`length`, `letters`, `numbers`, `symbols`): `string` + +Generate a random string with fine control over letters, numbers & symbols + +#### Parameters + +• **length**: `number` + +length of generated string + +• **letters**: `boolean` = `false` + +Add letters to pool + +• **numbers**: `boolean` = `false` + +Add numbers to pool + +• **symbols**: `boolean` = `false` + +Add symbols to pool + +#### Returns + +`string` + +generated string + +#### Example + +```ts +const randomLetter = randomString(1, true); +const randomChar = randomString(1, true, true, true); +``` + +#### Defined in + +src/string.ts:133 + +*** + +### validateEmail() + +> **validateEmail**(`email`): `boolean` + +Check if email is valid + +#### Parameters + +• **email**: `string` + +Target + +#### Returns + +`boolean` + +- Follows format + +#### Defined in + +src/string.ts:247 diff --git a/time.md b/time.md new file mode 100644 index 0000000..297c9df --- /dev/null +++ b/time.md @@ -0,0 +1,117 @@ +[@ztimson/utils](Home.md) / time + +# time + +## Functions + +### formatDate() + +> **formatDate**(`date`): `string` + +Return date formated highest to lowest: YYYY-MM-DD H:mm AM + +#### Parameters + +• **date**: `string` \| `number` \| `Date` + +Date or timestamp to convert to string + +#### Returns + +`string` + +Formated date + +#### Defined in + +src/time.ts:7 + +*** + +### sleep() + +> **sleep**(`ms`): `Promise`\<`void`\> + +Use in conjunction with `await` to pause an async script + +#### Parameters + +• **ms**: `number` + +Time to pause for in milliseconds + +#### Returns + +`Promise`\<`void`\> + +- Resolves promise when it's time to resume + +#### Example + +```js +await sleep(1000) // Pause for 1 second +``` + +#### Defined in + +src/time.ts:28 + +*** + +### sleepUntil() + +> **sleepUntil**(`fn`, `checkInterval`): `Promise`\<`void`\> + +Sleep while function returns true + +#### Parameters + +• **fn** + +Return true to continue + +• **checkInterval**: `number` = `100` + +Run function ever x milliseconds + +#### Returns + +`Promise`\<`void`\> + +Callback when sleep is over + +#### Example + +```js +let loading = true; +setTimeout(() => wait = false, 1000); +await sleepUntil(() => loading); // Won't continue until loading flag is false +``` + +#### Defined in + +src/time.ts:46 + +*** + +### timeUntil() + +> **timeUntil**(`date`): `number` + +Calculate the number of milliseconds until date/time + +#### Parameters + +• **date**: `number` \| `Date` + +Target + +#### Returns + +`number` + +- Number of milliseconds until target + +#### Defined in + +src/time.ts:56 diff --git a/types.md b/types.md new file mode 100644 index 0000000..7822e0c --- /dev/null +++ b/types.md @@ -0,0 +1,38 @@ +[@ztimson/utils](Home.md) / types + +# types + +## Functions + +### tyoeKeys() + +> **tyoeKeys**\<`T`\>(): keyof `T`[] + +Return keys on a type as an array of strings + +#### Type Parameters + +• **T** *extends* `object` + +#### Returns + +keyof `T`[] + +Available keys + +#### Example + +```ts +type Person = { + firstName: string; + lastName: string; + age: number; +} + +const keys = typeKeys(); +console.log(keys); // Output: ["firstName", "lastName", "age"] +``` + +#### Defined in + +src/types.ts:18