@design-edito/tools 0.1.18 → 0.1.20
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/agnostic/css/index.js +14 -13
- package/agnostic/errors/index.d.ts +2 -0
- package/agnostic/errors/index.js +3 -2
- package/agnostic/errors/register/index.d.ts +21 -31
- package/agnostic/errors/register/index.js +1 -1
- package/agnostic/errors/unknown-to-string/index.d.ts +1 -0
- package/agnostic/errors/unknown-to-string/index.js +6 -0
- package/agnostic/html/index.js +15 -14
- package/agnostic/html/sanitize/index.js +5 -4
- package/agnostic/html/selector-to-element/index.js +5 -4
- package/agnostic/html/string-to-nodes/index.js +6 -5
- package/agnostic/misc/index.js +9 -9
- package/agnostic/misc/web-crawler/index.d.ts +16 -0
- package/agnostic/misc/web-crawler/index.js +42 -0
- package/agnostic/numbers/index.js +5 -5
- package/agnostic/objects/index.js +7 -7
- package/agnostic/optim/index.js +3 -3
- package/agnostic/strings/index.js +6 -6
- package/agnostic/time/index.d.ts +9 -0
- package/agnostic/time/index.js +35 -0
- package/chunks/{chunk-WQI4RK2W.js → chunk-2H4QYFEP.js} +1 -1
- package/chunks/{chunk-BC22JVVY.js → chunk-2KT7AKRW.js} +5 -1
- package/chunks/{chunk-FMGKTQK4.js → chunk-6ETCY4VK.js} +2 -2
- package/chunks/{chunk-BG6HX6CQ.js → chunk-C5WKMLKU.js} +1 -1
- package/chunks/chunk-FENXVJYO.js +11 -0
- package/chunks/{chunk-2ZQYNOGG.js → chunk-FYHRUYTU.js} +1 -1
- package/chunks/{chunk-WRS4WCFS.js → chunk-QHLQVR3E.js} +4 -0
- package/package.json +2 -1
package/agnostic/css/index.js
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
Random
|
3
|
+
} from "../../chunks/chunk-WLL3FNVL.js";
|
4
|
+
import {
|
5
|
+
register
|
6
|
+
} from "../../chunks/chunk-C5WKMLKU.js";
|
7
|
+
import {
|
8
|
+
Crossenv
|
9
|
+
} from "../../chunks/chunk-GJOU3UAL.js";
|
5
10
|
import {
|
6
11
|
Bem
|
7
12
|
} from "../../chunks/chunk-KIONYWA7.js";
|
@@ -10,16 +15,12 @@ import {
|
|
10
15
|
isValidClassName
|
11
16
|
} from "../../chunks/chunk-W5A2TON3.js";
|
12
17
|
import {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
import
|
19
|
-
Crossenv
|
20
|
-
} from "../../chunks/chunk-GJOU3UAL.js";
|
21
|
-
import "../../chunks/chunk-BC22JVVY.js";
|
22
|
-
import "../../chunks/chunk-WRS4WCFS.js";
|
18
|
+
generateNiceColor,
|
19
|
+
niceColors
|
20
|
+
} from "../../chunks/chunk-EDVNAV3G.js";
|
21
|
+
import "../../chunks/chunk-2KT7AKRW.js";
|
22
|
+
import "../../chunks/chunk-FENXVJYO.js";
|
23
|
+
import "../../chunks/chunk-QHLQVR3E.js";
|
23
24
|
import "../../chunks/chunk-QXAJXTXV.js";
|
24
25
|
import "../../chunks/chunk-HC6ZOHCS.js";
|
25
26
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { Register as RegisterNamespace } from './register';
|
2
|
+
import { unknownToString as unknownToStringFunc } from './unknown-to-string';
|
2
3
|
export declare namespace Errors {
|
3
4
|
export import Register = RegisterNamespace;
|
5
|
+
const unknownToString: typeof unknownToStringFunc;
|
4
6
|
}
|
package/agnostic/errors/index.js
CHANGED
@@ -1,44 +1,34 @@
|
|
1
1
|
export declare namespace Register {
|
2
2
|
type RegisterEntry = {
|
3
3
|
message: string;
|
4
|
-
detailsMaker: (...
|
4
|
+
detailsMaker: (...p: any[]) => any;
|
5
5
|
};
|
6
|
-
type
|
7
|
-
[
|
8
|
-
}
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
type DetailsMaker<Source extends
|
13
|
-
|
14
|
-
|
15
|
-
type
|
16
|
-
[k: string]: RegisterEntry;
|
17
|
-
}, Code extends RegisterKeys<Source>> = Parameters<DetailsMaker<Source, Code>>;
|
18
|
-
type Details<Source extends {
|
19
|
-
[k: string]: RegisterEntry;
|
20
|
-
}, Code extends RegisterKeys<Source>> = ReturnType<DetailsMaker<Source, Code>>;
|
21
|
-
type ErrorData<Source extends {
|
22
|
-
[k: string]: RegisterEntry;
|
23
|
-
}, Code extends RegisterKeys<Source>> = {
|
6
|
+
type Source<C extends string> = {
|
7
|
+
[K in C]: RegisterEntry;
|
8
|
+
};
|
9
|
+
function makeSource<S extends Source<string>>(s: S): S;
|
10
|
+
type RegisterKeys<S extends Source<string>> = keyof S;
|
11
|
+
type Message<S extends Source<string>, Code extends RegisterKeys<S>> = S[Code]['message'];
|
12
|
+
type DetailsMaker<S extends Source<string>, Code extends RegisterKeys<S>> = S[Code]['detailsMaker'];
|
13
|
+
type DetailsMakerParams<S extends Source<string>, Code extends RegisterKeys<S>> = Parameters<DetailsMaker<S, Code>>;
|
14
|
+
type Details<S extends Source<string>, Code extends RegisterKeys<S>> = ReturnType<DetailsMaker<S, Code>>;
|
15
|
+
type ErrorData<S extends Source<string>, Code extends RegisterKeys<S>> = {
|
24
16
|
code: Code;
|
25
|
-
message: Message<
|
26
|
-
details: Details<
|
17
|
+
message: Message<S, Code>;
|
18
|
+
details: Details<S, Code>;
|
27
19
|
};
|
28
|
-
function from<
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
getErrorData: <Code extends RegisterKeys<Source>>(code: Code, ...params: DetailsMakerParams<Source, Code>) => ErrorData<Source, Code>;
|
35
|
-
getError: <Code extends RegisterKeys<Source>>(code: Code, ...params: DetailsMakerParams<Source, Code>) => {
|
20
|
+
function from<S extends Source<string>>(source: S): {
|
21
|
+
getMessage: <Code extends RegisterKeys<S>>(code: Code) => Message<S, Code>;
|
22
|
+
getDetailsMaker: <Code extends RegisterKeys<S>>(code: Code) => DetailsMaker<S, Code>;
|
23
|
+
getDetails: <Code extends RegisterKeys<S>>(code: Code, ...params: DetailsMakerParams<S, Code>) => Details<S, Code>;
|
24
|
+
getErrorData: <Code extends RegisterKeys<S>>(code: Code, ...params: DetailsMakerParams<S, Code>) => ErrorData<S, Code>;
|
25
|
+
getError: <Code extends RegisterKeys<S>>(code: Code, ...params: DetailsMakerParams<S, Code>) => {
|
36
26
|
code: Code;
|
37
|
-
details: ReturnType<DetailsMaker<
|
27
|
+
details: ReturnType<DetailsMaker<S, Code>>;
|
38
28
|
name: string;
|
39
29
|
message: string;
|
40
30
|
stack?: string;
|
41
31
|
};
|
42
|
-
source:
|
32
|
+
source: S;
|
43
33
|
};
|
44
34
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function unknownToString(err: unknown): string;
|
package/agnostic/html/index.js
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
stringToNodes
|
3
|
-
} from "../../chunks/chunk-FMGKTQK4.js";
|
4
|
-
import {
|
5
|
-
Sanitize
|
6
|
-
} from "../../chunks/chunk-WQI4RK2W.js";
|
7
1
|
import {
|
8
2
|
getNodeAncestors
|
9
3
|
} from "../../chunks/chunk-SQZGZ3VT.js";
|
@@ -11,18 +5,25 @@ import {
|
|
11
5
|
getPositionInsideParent
|
12
6
|
} from "../../chunks/chunk-VTPRO4NJ.js";
|
13
7
|
import {
|
14
|
-
|
15
|
-
} from "../../chunks/chunk-
|
16
|
-
import "../../chunks/chunk-BG6HX6CQ.js";
|
17
|
-
import "../../chunks/chunk-GJOU3UAL.js";
|
18
|
-
import "../../chunks/chunk-BC22JVVY.js";
|
19
|
-
import "../../chunks/chunk-WRS4WCFS.js";
|
8
|
+
Placeholders
|
9
|
+
} from "../../chunks/chunk-VYW4IADX.js";
|
20
10
|
import {
|
21
11
|
insertNode
|
22
12
|
} from "../../chunks/chunk-XA4HVHJ4.js";
|
23
13
|
import {
|
24
|
-
|
25
|
-
} from "../../chunks/chunk-
|
14
|
+
selectorToElement
|
15
|
+
} from "../../chunks/chunk-FYHRUYTU.js";
|
16
|
+
import {
|
17
|
+
stringToNodes
|
18
|
+
} from "../../chunks/chunk-6ETCY4VK.js";
|
19
|
+
import {
|
20
|
+
Sanitize
|
21
|
+
} from "../../chunks/chunk-2H4QYFEP.js";
|
22
|
+
import "../../chunks/chunk-C5WKMLKU.js";
|
23
|
+
import "../../chunks/chunk-GJOU3UAL.js";
|
24
|
+
import "../../chunks/chunk-2KT7AKRW.js";
|
25
|
+
import "../../chunks/chunk-FENXVJYO.js";
|
26
|
+
import "../../chunks/chunk-QHLQVR3E.js";
|
26
27
|
|
27
28
|
// src/agnostic/html/index.ts
|
28
29
|
var Html;
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import {
|
2
2
|
Sanitize
|
3
|
-
} from "../../../chunks/chunk-
|
4
|
-
import "../../../chunks/chunk-
|
3
|
+
} from "../../../chunks/chunk-2H4QYFEP.js";
|
4
|
+
import "../../../chunks/chunk-C5WKMLKU.js";
|
5
5
|
import "../../../chunks/chunk-GJOU3UAL.js";
|
6
|
-
import "../../../chunks/chunk-
|
7
|
-
import "../../../chunks/chunk-
|
6
|
+
import "../../../chunks/chunk-2KT7AKRW.js";
|
7
|
+
import "../../../chunks/chunk-FENXVJYO.js";
|
8
|
+
import "../../../chunks/chunk-QHLQVR3E.js";
|
8
9
|
export {
|
9
10
|
Sanitize
|
10
11
|
};
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import {
|
2
2
|
selectorToElement
|
3
|
-
} from "../../../chunks/chunk-
|
4
|
-
import "../../../chunks/chunk-
|
3
|
+
} from "../../../chunks/chunk-FYHRUYTU.js";
|
4
|
+
import "../../../chunks/chunk-C5WKMLKU.js";
|
5
5
|
import "../../../chunks/chunk-GJOU3UAL.js";
|
6
|
-
import "../../../chunks/chunk-
|
7
|
-
import "../../../chunks/chunk-
|
6
|
+
import "../../../chunks/chunk-2KT7AKRW.js";
|
7
|
+
import "../../../chunks/chunk-FENXVJYO.js";
|
8
|
+
import "../../../chunks/chunk-QHLQVR3E.js";
|
8
9
|
export {
|
9
10
|
selectorToElement
|
10
11
|
};
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import {
|
2
2
|
stringToNodes
|
3
|
-
} from "../../../chunks/chunk-
|
4
|
-
import "../../../chunks/chunk-
|
5
|
-
import "../../../chunks/chunk-
|
3
|
+
} from "../../../chunks/chunk-6ETCY4VK.js";
|
4
|
+
import "../../../chunks/chunk-2H4QYFEP.js";
|
5
|
+
import "../../../chunks/chunk-C5WKMLKU.js";
|
6
6
|
import "../../../chunks/chunk-GJOU3UAL.js";
|
7
|
-
import "../../../chunks/chunk-
|
8
|
-
import "../../../chunks/chunk-
|
7
|
+
import "../../../chunks/chunk-2KT7AKRW.js";
|
8
|
+
import "../../../chunks/chunk-FENXVJYO.js";
|
9
|
+
import "../../../chunks/chunk-QHLQVR3E.js";
|
9
10
|
export {
|
10
11
|
stringToNodes
|
11
12
|
};
|
package/agnostic/misc/index.js
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
+
import {
|
2
|
+
Logs
|
3
|
+
} from "../../chunks/chunk-HEJV6JIO.js";
|
1
4
|
import {
|
2
5
|
Assert
|
3
6
|
} from "../../chunks/chunk-W7YBGJ4H.js";
|
7
|
+
import {
|
8
|
+
Cast
|
9
|
+
} from "../../chunks/chunk-4QQBKBYH.js";
|
4
10
|
import {
|
5
11
|
getCurrentDownlink
|
6
12
|
} from "../../chunks/chunk-7AWTHZLY.js";
|
7
|
-
import {
|
8
|
-
Logs
|
9
|
-
} from "../../chunks/chunk-HEJV6JIO.js";
|
10
13
|
import {
|
11
14
|
Random
|
12
15
|
} from "../../chunks/chunk-WLL3FNVL.js";
|
13
|
-
import {
|
14
|
-
Cast
|
15
|
-
} from "../../chunks/chunk-4QQBKBYH.js";
|
16
16
|
import {
|
17
17
|
Crossenv
|
18
18
|
} from "../../chunks/chunk-GJOU3UAL.js";
|
19
|
+
import {
|
20
|
+
isConstructorFunction
|
21
|
+
} from "../../chunks/chunk-RCO57B6F.js";
|
19
22
|
import "../../chunks/chunk-QXAJXTXV.js";
|
20
23
|
import {
|
21
24
|
isNotNullish,
|
22
25
|
isNullish,
|
23
26
|
nullishValues
|
24
27
|
} from "../../chunks/chunk-HC6ZOHCS.js";
|
25
|
-
import {
|
26
|
-
isConstructorFunction
|
27
|
-
} from "../../chunks/chunk-RCO57B6F.js";
|
28
28
|
|
29
29
|
// src/agnostic/misc/index.ts
|
30
30
|
var Misc;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export declare namespace WebCrawler {
|
2
|
+
function create<T extends any>(options: {
|
3
|
+
limit: number;
|
4
|
+
delayMs?: number | (() => number);
|
5
|
+
fetcher: (url: string) => Promise<T>;
|
6
|
+
processor: (url: string, content: T, hooks: {
|
7
|
+
push: (...urls: string[]) => void;
|
8
|
+
flush: () => void;
|
9
|
+
}) => any;
|
10
|
+
logger?: (ops: number, url: string, waitlist: string[], processed: Set<string>) => void;
|
11
|
+
}): {
|
12
|
+
crawl: (startUrl: string) => Promise<void>;
|
13
|
+
push: (url: string) => number;
|
14
|
+
flush: () => void;
|
15
|
+
};
|
16
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import {
|
2
|
+
wait
|
3
|
+
} from "../../../chunks/chunk-DQNJQBC6.js";
|
4
|
+
|
5
|
+
// src/agnostic/misc/web-crawler/index.ts
|
6
|
+
var WebCrawler;
|
7
|
+
((WebCrawler2) => {
|
8
|
+
function create(options) {
|
9
|
+
let ops = 0;
|
10
|
+
const waitlist = [];
|
11
|
+
const push = (url) => waitlist.push(url);
|
12
|
+
const flush = () => {
|
13
|
+
waitlist.length = 0;
|
14
|
+
};
|
15
|
+
const processed = /* @__PURE__ */ new Set();
|
16
|
+
const crawl = async (startUrl) => {
|
17
|
+
push(startUrl);
|
18
|
+
while (waitlist.length > 0 && ops < options.limit) {
|
19
|
+
ops++;
|
20
|
+
const currentUrl = waitlist[0];
|
21
|
+
if (options.logger !== void 0) options.logger(ops, currentUrl, waitlist, processed);
|
22
|
+
if (!processed.has(currentUrl)) {
|
23
|
+
const content = await options.fetcher(currentUrl);
|
24
|
+
await options.processor(currentUrl, content, { push, flush });
|
25
|
+
}
|
26
|
+
waitlist.shift();
|
27
|
+
processed.add(currentUrl);
|
28
|
+
const delayMs = typeof options.delayMs === "function" ? options.delayMs() : typeof options.delayMs === "number" ? options.delayMs : 0;
|
29
|
+
if (delayMs !== 0) await wait(delayMs);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
return {
|
33
|
+
crawl,
|
34
|
+
push,
|
35
|
+
flush
|
36
|
+
};
|
37
|
+
}
|
38
|
+
WebCrawler2.create = create;
|
39
|
+
})(WebCrawler || (WebCrawler = {}));
|
40
|
+
export {
|
41
|
+
WebCrawler
|
42
|
+
};
|
@@ -1,9 +1,12 @@
|
|
1
|
+
import {
|
2
|
+
absoluteModulo
|
3
|
+
} from "../../chunks/chunk-DNIOWD7K.js";
|
1
4
|
import {
|
2
5
|
clamp
|
3
6
|
} from "../../chunks/chunk-OSAXBA7G.js";
|
4
7
|
import {
|
5
|
-
|
6
|
-
} from "../../chunks/chunk-
|
8
|
+
interpolate
|
9
|
+
} from "../../chunks/chunk-EW46EXFB.js";
|
7
10
|
import {
|
8
11
|
createScale,
|
9
12
|
getHarmonic
|
@@ -11,9 +14,6 @@ import {
|
|
11
14
|
import {
|
12
15
|
round
|
13
16
|
} from "../../chunks/chunk-32IRF4OP.js";
|
14
|
-
import {
|
15
|
-
interpolate
|
16
|
-
} from "../../chunks/chunk-EW46EXFB.js";
|
17
17
|
|
18
18
|
// src/agnostic/numbers/index.ts
|
19
19
|
var Numbers;
|
@@ -1,20 +1,20 @@
|
|
1
|
+
import {
|
2
|
+
Enums
|
3
|
+
} from "../../chunks/chunk-WOAYU6LB.js";
|
4
|
+
import "../../chunks/chunk-E6MSDKON.js";
|
1
5
|
import {
|
2
6
|
flattenGetters
|
3
7
|
} from "../../chunks/chunk-PO3V3I57.js";
|
8
|
+
import {
|
9
|
+
isRecord
|
10
|
+
} from "../../chunks/chunk-YDIBNEGA.js";
|
4
11
|
import {
|
5
12
|
isNonNullObject,
|
6
13
|
isObject
|
7
14
|
} from "../../chunks/chunk-HQLRJ7XW.js";
|
8
|
-
import {
|
9
|
-
isRecord
|
10
|
-
} from "../../chunks/chunk-YDIBNEGA.js";
|
11
15
|
import {
|
12
16
|
Validation
|
13
17
|
} from "../../chunks/chunk-FPEW3A27.js";
|
14
|
-
import {
|
15
|
-
Enums
|
16
|
-
} from "../../chunks/chunk-WOAYU6LB.js";
|
17
|
-
import "../../chunks/chunk-E6MSDKON.js";
|
18
18
|
import "../../chunks/chunk-4QQBKBYH.js";
|
19
19
|
import "../../chunks/chunk-QXAJXTXV.js";
|
20
20
|
import "../../chunks/chunk-HC6ZOHCS.js";
|
package/agnostic/optim/index.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
+
import {
|
2
|
+
toAlphanum
|
3
|
+
} from "../../chunks/chunk-COVPTTAD.js";
|
4
|
+
import {
|
5
|
+
replaceAll
|
6
|
+
} from "../../chunks/chunk-MF56TTC5.js";
|
1
7
|
import {
|
2
8
|
CharCodes
|
3
9
|
} from "../../chunks/chunk-34U4HX4V.js";
|
4
10
|
import {
|
5
11
|
normalizeIndent
|
6
12
|
} from "../../chunks/chunk-JQXNEJAP.js";
|
7
|
-
import {
|
8
|
-
toAlphanum
|
9
|
-
} from "../../chunks/chunk-COVPTTAD.js";
|
10
13
|
import {
|
11
14
|
matches,
|
12
15
|
matchesEvery,
|
13
16
|
matchesSome
|
14
17
|
} from "../../chunks/chunk-LQFKUNVQ.js";
|
15
|
-
import {
|
16
|
-
replaceAll
|
17
|
-
} from "../../chunks/chunk-MF56TTC5.js";
|
18
18
|
|
19
19
|
// src/agnostic/strings/index.ts
|
20
20
|
var Strings;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare namespace Time {
|
2
|
+
function secondsToMs(seconds: number): number;
|
3
|
+
function minutesToMs(minutes: number): number;
|
4
|
+
function hoursToMs(hours: number): number;
|
5
|
+
function daysToMs(days: number): number;
|
6
|
+
function weeksToMs(weeks: number): number;
|
7
|
+
function monthsToMs(months: number): number;
|
8
|
+
function yearsToMs(years: number): number;
|
9
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// src/agnostic/time/index.ts
|
2
|
+
var Time;
|
3
|
+
((Time2) => {
|
4
|
+
function secondsToMs(seconds) {
|
5
|
+
return seconds * 1e3;
|
6
|
+
}
|
7
|
+
Time2.secondsToMs = secondsToMs;
|
8
|
+
function minutesToMs(minutes) {
|
9
|
+
return secondsToMs(60 * minutes);
|
10
|
+
}
|
11
|
+
Time2.minutesToMs = minutesToMs;
|
12
|
+
function hoursToMs(hours) {
|
13
|
+
return minutesToMs(60 * hours);
|
14
|
+
}
|
15
|
+
Time2.hoursToMs = hoursToMs;
|
16
|
+
function daysToMs(days) {
|
17
|
+
return hoursToMs(24 * days);
|
18
|
+
}
|
19
|
+
Time2.daysToMs = daysToMs;
|
20
|
+
function weeksToMs(weeks) {
|
21
|
+
return daysToMs(7 * weeks);
|
22
|
+
}
|
23
|
+
Time2.weeksToMs = weeksToMs;
|
24
|
+
function monthsToMs(months) {
|
25
|
+
return daysToMs(30 * months);
|
26
|
+
}
|
27
|
+
Time2.monthsToMs = monthsToMs;
|
28
|
+
function yearsToMs(years) {
|
29
|
+
return daysToMs(365 * years);
|
30
|
+
}
|
31
|
+
Time2.yearsToMs = yearsToMs;
|
32
|
+
})(Time || (Time = {}));
|
33
|
+
export {
|
34
|
+
Time
|
35
|
+
};
|
@@ -1,11 +1,15 @@
|
|
1
|
+
import {
|
2
|
+
unknownToString
|
3
|
+
} from "./chunk-FENXVJYO.js";
|
1
4
|
import {
|
2
5
|
Register
|
3
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-QHLQVR3E.js";
|
4
7
|
|
5
8
|
// src/agnostic/errors/index.ts
|
6
9
|
var Errors;
|
7
10
|
((Errors2) => {
|
8
11
|
Errors2.Register = Register;
|
12
|
+
Errors2.unknownToString = unknownToString;
|
9
13
|
})(Errors || (Errors = {}));
|
10
14
|
|
11
15
|
export {
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// src/agnostic/errors/unknown-to-string/index.ts
|
2
|
+
function unknownToString(err) {
|
3
|
+
if (err instanceof Error) return err.message;
|
4
|
+
if (typeof err === "string") return err;
|
5
|
+
if (typeof err === "object" && err !== null) return JSON.stringify(err);
|
6
|
+
return `${err}`;
|
7
|
+
}
|
8
|
+
|
9
|
+
export {
|
10
|
+
unknownToString
|
11
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@design-edito/tools",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.20",
|
4
4
|
"description": "",
|
5
5
|
"author": "Maxime Fabas",
|
6
6
|
"license": "ISC",
|
@@ -27,6 +27,7 @@
|
|
27
27
|
"@types/semver": "^7.5.8",
|
28
28
|
"camelcase": "^8.0.0",
|
29
29
|
"esbuild": "^0.23.1",
|
30
|
+
"node-fetch": "^3.3.2",
|
30
31
|
"prompts": "^2.4.2",
|
31
32
|
"semver": "^7.6.3",
|
32
33
|
"simple-git": "^3.26.0",
|