@ztimson/utils 0.21.5 → 0.21.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +91 -91
- package/dist/array.d.ts +0 -0
- package/dist/aset.d.ts +0 -0
- package/dist/cache.d.ts +0 -0
- package/dist/csv.d.ts +0 -0
- package/dist/emitter.d.ts +0 -0
- package/dist/errors.d.ts +1 -1
- package/dist/files.d.ts +0 -0
- package/dist/http.d.ts +0 -0
- package/dist/index.cjs +16 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -0
- package/dist/index.mjs +16 -1
- package/dist/index.mjs.map +1 -1
- package/dist/jwt.d.ts +0 -0
- package/dist/logger.d.ts +0 -0
- package/dist/math.d.ts +0 -0
- package/dist/misc.d.ts +0 -0
- package/dist/objects.d.ts +0 -0
- package/dist/path-events.d.ts +0 -0
- package/dist/promise-progress.d.ts +0 -0
- package/dist/string.d.ts +0 -0
- package/dist/time.d.ts +7 -0
- package/dist/types.d.ts +0 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
<!-- Header -->
|
|
2
|
-
<div id="top" align="center">
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<!-- Logo -->
|
|
6
|
-
<img src="https://git.zakscode.com/repo-avatars/77dbab78e5fb3302dc9e751c4d6315a64df8d3a714d5cd5719b0dc39e6619119" alt="Logo" width="200" height="200">
|
|
7
|
-
|
|
8
|
-
<!-- Title -->
|
|
9
|
-
### @ztimson/utils
|
|
10
|
-
|
|
11
|
-
<!-- Description -->
|
|
12
|
-
Javascript/Typescript Utilities
|
|
13
|
-
|
|
14
|
-
<!-- Repo badges -->
|
|
15
|
-
[](https://git.zakscode.com/ztimson/utils/tags)
|
|
16
|
-
[](https://git.zakscode.com/ztimson/utils/pulls)
|
|
17
|
-
[](https://git.zakscode.com/ztimson/utils/issues)
|
|
18
|
-
|
|
19
|
-
<!-- Links -->
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
<div>
|
|
23
|
-
<a href="https://utils.docs.zakscode.com" target="_blank">Documentation</a>
|
|
24
|
-
• <a href="https://git.zakscode.com/ztimson/utils/releases" target="_blank">Release Notes</a>
|
|
25
|
-
• <a href="https://git.zakscode.com/ztimson/utils/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
|
|
26
|
-
• <a href="https://git.zakscode.com/ztimson/utils/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
## Table of Contents
|
|
33
|
-
- [@ztimson/utils](#top)
|
|
34
|
-
- [About](#about)
|
|
35
|
-
- [Built With](#built-with)
|
|
36
|
-
- [Setup](#setup)
|
|
37
|
-
- [Production](#production)
|
|
38
|
-
- [Development](#development)
|
|
39
|
-
- [Documentation](https://utils.docs.zakscode.com/)
|
|
40
|
-
- [License](#license)
|
|
41
|
-
|
|
42
|
-
## About
|
|
43
|
-
|
|
44
|
-
A collection of utilities to make life a little easier
|
|
45
|
-
|
|
46
|
-
### Built With
|
|
47
|
-
[](https://typescriptlang.org/)
|
|
48
|
-
|
|
49
|
-
## Setup
|
|
50
|
-
|
|
51
|
-
<details>
|
|
52
|
-
<summary>
|
|
53
|
-
<h3 id="production" style="display: inline">
|
|
54
|
-
Production
|
|
55
|
-
</h3>
|
|
56
|
-
</summary>
|
|
57
|
-
|
|
58
|
-
#### Prerequisites
|
|
59
|
-
- [Node.js](https://nodejs.org/en/download)
|
|
60
|
-
|
|
61
|
-
#### Instructions
|
|
62
|
-
1. Install persist: `npm i @ztimosn/utils`
|
|
63
|
-
|
|
64
|
-
</details>
|
|
65
|
-
|
|
66
|
-
<details>
|
|
67
|
-
<summary>
|
|
68
|
-
<h3 id="development" style="display: inline">
|
|
69
|
-
Development
|
|
70
|
-
</h3>
|
|
71
|
-
</summary>
|
|
72
|
-
|
|
73
|
-
#### Prerequisites
|
|
74
|
-
- [Node.js](https://nodejs.org/en/download)
|
|
75
|
-
|
|
76
|
-
#### Instructions
|
|
77
|
-
1. Install the dependencies: `npm i`
|
|
78
|
-
2. Build library: `npm build`
|
|
79
|
-
3. Run unit tests: `npm test`
|
|
80
|
-
|
|
81
|
-
</details>
|
|
82
|
-
|
|
83
|
-
## Documentation
|
|
84
|
-
|
|
85
|
-
[Available Here](https://utils.docs.zakscode.com/)
|
|
86
|
-
|
|
87
|
-
## License
|
|
88
|
-
|
|
89
|
-
Copyright © 2023 Zakary Timson | Available under MIT Licensing
|
|
90
|
-
|
|
91
|
-
See the [license](_media/LICENSE) for more information.
|
|
1
|
+
<!-- Header -->
|
|
2
|
+
<div id="top" align="center">
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<!-- Logo -->
|
|
6
|
+
<img src="https://git.zakscode.com/repo-avatars/77dbab78e5fb3302dc9e751c4d6315a64df8d3a714d5cd5719b0dc39e6619119" alt="Logo" width="200" height="200">
|
|
7
|
+
|
|
8
|
+
<!-- Title -->
|
|
9
|
+
### @ztimson/utils
|
|
10
|
+
|
|
11
|
+
<!-- Description -->
|
|
12
|
+
Javascript/Typescript Utilities
|
|
13
|
+
|
|
14
|
+
<!-- Repo badges -->
|
|
15
|
+
[](https://git.zakscode.com/ztimson/utils/tags)
|
|
16
|
+
[](https://git.zakscode.com/ztimson/utils/pulls)
|
|
17
|
+
[](https://git.zakscode.com/ztimson/utils/issues)
|
|
18
|
+
|
|
19
|
+
<!-- Links -->
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
<div>
|
|
23
|
+
<a href="https://utils.docs.zakscode.com" target="_blank">Documentation</a>
|
|
24
|
+
• <a href="https://git.zakscode.com/ztimson/utils/releases" target="_blank">Release Notes</a>
|
|
25
|
+
• <a href="https://git.zakscode.com/ztimson/utils/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
|
|
26
|
+
• <a href="https://git.zakscode.com/ztimson/utils/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
## Table of Contents
|
|
33
|
+
- [@ztimson/utils](#top)
|
|
34
|
+
- [About](#about)
|
|
35
|
+
- [Built With](#built-with)
|
|
36
|
+
- [Setup](#setup)
|
|
37
|
+
- [Production](#production)
|
|
38
|
+
- [Development](#development)
|
|
39
|
+
- [Documentation](https://utils.docs.zakscode.com/)
|
|
40
|
+
- [License](#license)
|
|
41
|
+
|
|
42
|
+
## About
|
|
43
|
+
|
|
44
|
+
A collection of utilities to make life a little easier
|
|
45
|
+
|
|
46
|
+
### Built With
|
|
47
|
+
[](https://typescriptlang.org/)
|
|
48
|
+
|
|
49
|
+
## Setup
|
|
50
|
+
|
|
51
|
+
<details>
|
|
52
|
+
<summary>
|
|
53
|
+
<h3 id="production" style="display: inline">
|
|
54
|
+
Production
|
|
55
|
+
</h3>
|
|
56
|
+
</summary>
|
|
57
|
+
|
|
58
|
+
#### Prerequisites
|
|
59
|
+
- [Node.js](https://nodejs.org/en/download)
|
|
60
|
+
|
|
61
|
+
#### Instructions
|
|
62
|
+
1. Install persist: `npm i @ztimosn/utils`
|
|
63
|
+
|
|
64
|
+
</details>
|
|
65
|
+
|
|
66
|
+
<details>
|
|
67
|
+
<summary>
|
|
68
|
+
<h3 id="development" style="display: inline">
|
|
69
|
+
Development
|
|
70
|
+
</h3>
|
|
71
|
+
</summary>
|
|
72
|
+
|
|
73
|
+
#### Prerequisites
|
|
74
|
+
- [Node.js](https://nodejs.org/en/download)
|
|
75
|
+
|
|
76
|
+
#### Instructions
|
|
77
|
+
1. Install the dependencies: `npm i`
|
|
78
|
+
2. Build library: `npm build`
|
|
79
|
+
3. Run unit tests: `npm test`
|
|
80
|
+
|
|
81
|
+
</details>
|
|
82
|
+
|
|
83
|
+
## Documentation
|
|
84
|
+
|
|
85
|
+
[Available Here](https://utils.docs.zakscode.com/)
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
Copyright © 2023 Zakary Timson | Available under MIT Licensing
|
|
90
|
+
|
|
91
|
+
See the [license](_media/LICENSE) for more information.
|
package/dist/array.d.ts
CHANGED
|
File without changes
|
package/dist/aset.d.ts
CHANGED
|
File without changes
|
package/dist/cache.d.ts
CHANGED
|
File without changes
|
package/dist/csv.d.ts
CHANGED
|
File without changes
|
package/dist/emitter.d.ts
CHANGED
|
File without changes
|
package/dist/errors.d.ts
CHANGED
|
@@ -74,4 +74,4 @@ export declare class GatewayTimeoutError extends CustomError {
|
|
|
74
74
|
* @param {string} message Override default error message
|
|
75
75
|
* @return {CustomError} The proper error type
|
|
76
76
|
*/
|
|
77
|
-
export declare function errorFromCode(code: number, message?: string): CustomError
|
|
77
|
+
export declare function errorFromCode(code: number, message?: string): CustomError;
|
package/dist/files.d.ts
CHANGED
|
File without changes
|
package/dist/http.d.ts
CHANGED
|
File without changes
|
package/dist/index.cjs
CHANGED
|
@@ -711,7 +711,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
711
711
|
}
|
|
712
712
|
__publicField(GatewayTimeoutError, "code", 504);
|
|
713
713
|
function errorFromCode(code, message) {
|
|
714
|
-
if (code >= 200 && code < 300) return null;
|
|
715
714
|
switch (code) {
|
|
716
715
|
case 400:
|
|
717
716
|
return new BadRequestError(message);
|
|
@@ -1320,6 +1319,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1320
1319
|
emitter.on("*", (event, ...args) => this.emit(event, ...args));
|
|
1321
1320
|
}
|
|
1322
1321
|
}
|
|
1322
|
+
function adjustedInterval(cb, ms) {
|
|
1323
|
+
let cancel = false, timeout = null;
|
|
1324
|
+
const p = async () => {
|
|
1325
|
+
if (cancel) return;
|
|
1326
|
+
const start = (/* @__PURE__ */ new Date()).getTime();
|
|
1327
|
+
await cb();
|
|
1328
|
+
const end = (/* @__PURE__ */ new Date()).getTime();
|
|
1329
|
+
timeout = setTimeout(() => p(), ms - (end - start) || 1);
|
|
1330
|
+
};
|
|
1331
|
+
p();
|
|
1332
|
+
return () => {
|
|
1333
|
+
cancel = true;
|
|
1334
|
+
if (timeout) clearTimeout(timeout);
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1323
1337
|
function formatDate(date) {
|
|
1324
1338
|
if (typeof date == "number" || typeof date == "string") date = new Date(date);
|
|
1325
1339
|
let hours = date.getHours(), postfix = "AM";
|
|
@@ -1372,6 +1386,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1372
1386
|
exports2.TypedEmitter = TypedEmitter;
|
|
1373
1387
|
exports2.UnauthorizedError = UnauthorizedError;
|
|
1374
1388
|
exports2.addUnique = addUnique;
|
|
1389
|
+
exports2.adjustedInterval = adjustedInterval;
|
|
1375
1390
|
exports2.arrayDiff = arrayDiff;
|
|
1376
1391
|
exports2.caseInsensitiveSort = caseInsensitiveSort;
|
|
1377
1392
|
exports2.clean = clean;
|