@zoodogood/utils 1.1.3-change.1055 → 1.2.0-change.1444

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.
@@ -1,2 +1,4 @@
1
1
  export * from "./Result.js";
2
+ export * from "./Option.js";
3
+ export * from "./BooleanWithMessage.js";
2
4
  export * from "./main.js";
@@ -1,2 +1,4 @@
1
1
  export * from "./Result.js";
2
+ export * from "./Option.js";
3
+ export * from "./BooleanWithMessage.js";
2
4
  export * from "./main.js";
@@ -0,0 +1,75 @@
1
+ type TCompareSequence = string | RegExp;
2
+ interface IBracketVariant {
3
+ key: string;
4
+ start: TCompareSequence;
5
+ end: TCompareSequence;
6
+ isRegex?: boolean;
7
+ isSequence?: boolean;
8
+ }
9
+ declare class StackElement {
10
+ indexInText?: number;
11
+ isRegex: boolean;
12
+ match: null;
13
+ key?: string;
14
+ full?: string;
15
+ variant?: IBracketVariant;
16
+ get length(): number | undefined;
17
+ static from(data: unknown): StackElement;
18
+ }
19
+ declare class GroupElement {
20
+ start?: StackElement;
21
+ end?: StackElement;
22
+ content?: string;
23
+ subgroups: GroupElement[];
24
+ depth: number;
25
+ get key(): string | undefined;
26
+ get indexInText(): number | undefined;
27
+ get length(): number;
28
+ get full(): string | null;
29
+ isParentFor(group: GroupElement): boolean;
30
+ static from(data: unknown): GroupElement;
31
+ }
32
+ declare class ParseContext {
33
+ stack: StackElement[];
34
+ indexInText: number;
35
+ text?: string;
36
+ groups: Array<GroupElement>;
37
+ setText(text: string): void;
38
+ appendGroup(group: GroupElement): void;
39
+ }
40
+ export declare class BracketsParser {
41
+ variants: Map<string, IBracketVariant>;
42
+ addBracketVariant(...variants: IBracketVariant[]): this;
43
+ setBracketVariant(...variants: IBracketVariant[]): this;
44
+ processSymbol(symbol: string, context: ParseContext): void;
45
+ processBracket(symbol: string, context: ParseContext): void;
46
+ processBracketClose(symbol: string, context: ParseContext): StackElement | undefined;
47
+ _createGroup(start: StackElement, end: StackElement, context: ParseContext): GroupElement;
48
+ processBracketOpen(symbol: string, context: ParseContext): StackElement | null;
49
+ /**
50
+ * @note Regular sequences of expressions must starts with ^
51
+ */
52
+ sequenceCaptureProtocol(compare: TCompareSequence, context: ParseContext): {
53
+ match: true | RegExpMatchArray;
54
+ isRegex: boolean;
55
+ full: string;
56
+ indexInText: number;
57
+ } | null;
58
+ symbolCaptureProtocol(symbol: string, compare: TCompareSequence, context: ParseContext): {
59
+ match: true | RegExpMatchArray;
60
+ isRegex: boolean;
61
+ full: string;
62
+ indexInText: number;
63
+ } | null;
64
+ processSlash(symbol: string, context: ParseContext): void;
65
+ parse(text: string): ParseContext;
66
+ static ParseContext: typeof ParseContext;
67
+ static GroupElement: typeof GroupElement;
68
+ static StackElement: typeof StackElement;
69
+ static get defaultBracketVariants(): {
70
+ key: string;
71
+ start: string;
72
+ end: string;
73
+ }[];
74
+ }
75
+ export {};
@@ -0,0 +1,206 @@
1
+ class StackElement {
2
+ constructor() {
3
+ this.isRegex = false;
4
+ this.match = null;
5
+ }
6
+ get length() {
7
+ var _a;
8
+ return (_a = this.full) === null || _a === void 0 ? void 0 : _a.length;
9
+ }
10
+ static from(data) {
11
+ return Object.assign(new this(), data);
12
+ }
13
+ }
14
+ class GroupElement {
15
+ constructor() {
16
+ this.subgroups = [];
17
+ this.depth = 0;
18
+ }
19
+ get key() {
20
+ var _a;
21
+ return (_a = this.start) === null || _a === void 0 ? void 0 : _a.key;
22
+ }
23
+ get indexInText() {
24
+ var _a;
25
+ return (_a = this.start) === null || _a === void 0 ? void 0 : _a.indexInText;
26
+ }
27
+ get length() {
28
+ var _a, _b, _c, _d;
29
+ return (
30
+ // @ts-expect-error May be undefined
31
+ ((_a = this.end) === null || _a === void 0 ? void 0 : _a.indexInText) - ((_b = this.start) === null || _b === void 0 ? void 0 : _b.indexInText) + ((_d = (_c = this.end) === null || _c === void 0 ? void 0 : _c.full) === null || _d === void 0 ? void 0 : _d.length));
32
+ }
33
+ get full() {
34
+ var _a, _b;
35
+ // @ts-expect-error May be undefined
36
+ return ((_a = this.start) === null || _a === void 0 ? void 0 : _a.full) + this.content + ((_b = this.end) === null || _b === void 0 ? void 0 : _b.full) || null;
37
+ }
38
+ isParentFor(group) {
39
+ const { start: targetStart, end: targetEnd } = group;
40
+ return (
41
+ // @ts-expect-error Maybe null
42
+ this.start.indexInText < targetStart.indexInText &&
43
+ // @ts-expect-error Maybe null
44
+ this.end.indexInText > targetEnd.indexInText);
45
+ }
46
+ static from(data) {
47
+ return Object.assign(new this(), data);
48
+ }
49
+ }
50
+ class ParseContext {
51
+ constructor() {
52
+ this.stack = [];
53
+ this.indexInText = 0;
54
+ this.groups = [];
55
+ }
56
+ setText(text) {
57
+ this.text = text;
58
+ }
59
+ appendGroup(group) {
60
+ this.groups.push(group);
61
+ }
62
+ }
63
+ export class BracketsParser {
64
+ constructor() {
65
+ this.variants = new Map();
66
+ }
67
+ addBracketVariant(...variants) {
68
+ for (const variant of variants) {
69
+ const { key } = variant;
70
+ this.variants.set(key, variant);
71
+ }
72
+ return this;
73
+ }
74
+ setBracketVariant(...variants) {
75
+ [...this.variants.keys()].forEach((key) => this.variants.delete(key));
76
+ this.addBracketVariant(...variants);
77
+ return this;
78
+ }
79
+ processSymbol(symbol, context) {
80
+ this.processSlash(symbol, context);
81
+ this.processBracket(symbol, context);
82
+ }
83
+ processBracket(symbol, context) {
84
+ this.processBracketClose(symbol, context) ||
85
+ this.processBracketOpen(symbol, context);
86
+ }
87
+ processBracketClose(symbol, context) {
88
+ if (!context.stack.length) {
89
+ return;
90
+ }
91
+ const { key } = context.stack.at(-1);
92
+ const variant = this.variants.get(key);
93
+ const match = variant.isSequence
94
+ ? this.sequenceCaptureProtocol(variant.end, context)
95
+ : this.symbolCaptureProtocol(symbol, variant.end, context);
96
+ if (!match) {
97
+ return;
98
+ }
99
+ const start = context.stack.pop();
100
+ const end = StackElement.from(Object.assign(Object.assign({}, match), { key: variant.key, variant }));
101
+ const group = this._createGroup(start, end, context);
102
+ context.appendGroup(group);
103
+ return end;
104
+ }
105
+ _createGroup(start, end, context) {
106
+ const content = context.text.slice(start.indexInText + start.length, end.indexInText);
107
+ const group = GroupElement.from({ start, end, content });
108
+ const potentialChild = context.groups.at(-1);
109
+ if (potentialChild && group.isParentFor(potentialChild)) {
110
+ group.subgroups.push(potentialChild);
111
+ }
112
+ group.depth = context.stack.length;
113
+ return group;
114
+ }
115
+ processBracketOpen(symbol, context) {
116
+ const result = (() => {
117
+ for (const variant of this.variants.values()) {
118
+ const match = variant.isSequence
119
+ ? this.sequenceCaptureProtocol(variant.start, context)
120
+ : this.symbolCaptureProtocol(symbol, variant.start, context);
121
+ if (match) {
122
+ return { match, variant };
123
+ }
124
+ }
125
+ })();
126
+ if (!result) {
127
+ return null;
128
+ }
129
+ const { match, variant } = result;
130
+ const start = StackElement.from(Object.assign(Object.assign({}, match), { key: variant.key, variant }));
131
+ context.stack.push(start);
132
+ return start;
133
+ }
134
+ /**
135
+ * @note Regular sequences of expressions must starts with ^
136
+ */
137
+ sequenceCaptureProtocol(compare, context) {
138
+ const indexInText = context.indexInText;
139
+ const target = context.text.slice(indexInText);
140
+ const isRegex = compare instanceof RegExp;
141
+ const match = isRegex ? target.match(compare) : target.startsWith(compare);
142
+ if (!match) {
143
+ return null;
144
+ }
145
+ const full = (isRegex ? match[0] : compare);
146
+ context.indexInText += full.length - 1;
147
+ return { match, isRegex, full, indexInText };
148
+ }
149
+ symbolCaptureProtocol(symbol, compare, context) {
150
+ const indexInText = context.indexInText;
151
+ const isRegex = compare instanceof RegExp;
152
+ const match = isRegex ? symbol.match(compare) : symbol === compare;
153
+ if (!match) {
154
+ return null;
155
+ }
156
+ const full = symbol;
157
+ return { match, isRegex, full, indexInText };
158
+ }
159
+ processSlash(symbol, context) {
160
+ if (symbol !== "\\") {
161
+ return;
162
+ }
163
+ context.indexInText++;
164
+ }
165
+ parse(text) {
166
+ const context = new ParseContext();
167
+ context.setText(text);
168
+ while (true) {
169
+ const index = context.indexInText;
170
+ const symbol = text[index] || "";
171
+ this.processSymbol(symbol, context);
172
+ if (symbol === "") {
173
+ break;
174
+ }
175
+ context.indexInText++;
176
+ }
177
+ return context;
178
+ }
179
+ static get defaultBracketVariants() {
180
+ return [
181
+ {
182
+ key: "{}",
183
+ start: "{",
184
+ end: "}",
185
+ },
186
+ {
187
+ key: "[]",
188
+ start: "[",
189
+ end: "]",
190
+ },
191
+ {
192
+ key: "()",
193
+ start: "(",
194
+ end: ")",
195
+ },
196
+ {
197
+ key: '""',
198
+ start: '"',
199
+ end: '"',
200
+ },
201
+ ];
202
+ }
203
+ }
204
+ BracketsParser.ParseContext = ParseContext;
205
+ BracketsParser.GroupElement = GroupElement;
206
+ BracketsParser.StackElement = StackElement;
@@ -0,0 +1,89 @@
1
+ import { BracketsParser } from "./BracketsParser.js";
2
+ interface ITextMatch {
3
+ regex: RegExp;
4
+ name: string;
5
+ }
6
+ declare namespace BracketsNamespace {
7
+ type Context = InstanceType<typeof BracketsParser.ParseContext>;
8
+ type GroupElement = InstanceType<typeof BracketsManager.GroupElement>;
9
+ }
10
+ declare class BracketsManager extends BracketsParser {
11
+ primary: BracketsNamespace.GroupElement[];
12
+ constructor();
13
+ parse(): BracketsNamespace.Context;
14
+ parseSafe(text: string): {
15
+ context: BracketsNamespace.Context;
16
+ indexes: number[];
17
+ };
18
+ useWriteToPrimaryProtocol(context: BracketsNamespace.Context): {
19
+ indexes: number[];
20
+ };
21
+ toStringGroup(index: number): string;
22
+ findPrimaryGroups(context: BracketsNamespace.Context): BracketsNamespace.GroupElement[];
23
+ findBracketStamp(text: string): RegExpMatchArray | null;
24
+ processBracketGroupFromStringStamp(raw: string): BracketsNamespace.GroupElement | null;
25
+ }
26
+ interface IFlagCapture {
27
+ name?: string;
28
+ capture: string[];
29
+ expectValue?: boolean;
30
+ }
31
+ declare class FlagsManager {
32
+ unhandledFlags?: Array<RegExpMatchArray>;
33
+ captureResidueFlags(context: CliParserRunContext): this;
34
+ captureFlags(flags: IFlagCapture[], context: CliParserRunContext): this;
35
+ }
36
+ type TCaptureValue = string | RegExpMatchArray;
37
+ declare class CapturedContent {
38
+ content: TCaptureValue;
39
+ context?: CliParserRunContext;
40
+ constructor(content: TCaptureValue);
41
+ setContextInstance(context: CapturedContent["context"]): this;
42
+ isRegexMatchArray(): boolean;
43
+ isString(): boolean;
44
+ isBracketGroupStamp(): boolean | null;
45
+ toGroupElement(): BracketsNamespace.GroupElement | null;
46
+ toString(addable?: {
47
+ trim?: boolean;
48
+ smart?: boolean;
49
+ }): string | undefined;
50
+ regexArrayOrStringToString(): string;
51
+ static contentIsRegExpMatchArray(content: TCaptureValue): boolean;
52
+ static contentIsString(content: TCaptureValue): boolean;
53
+ static contentIsBracketGroupStamp(content: TCaptureValue, context: CliParserRunContext): boolean | null;
54
+ static contentToGroupElement(content: TCaptureValue, context: CliParserRunContext): BracketsNamespace.GroupElement | null;
55
+ static regexArrayOrStringToString(content: TCaptureValue): string;
56
+ static contentToString(content: TCaptureValue, context?: CliParserRunContext, { trim, smart }?: {
57
+ trim?: boolean | undefined;
58
+ smart?: boolean | undefined;
59
+ }): string | undefined;
60
+ }
61
+ declare class CliParserRunContext {
62
+ parser: CliParser;
63
+ input: string;
64
+ captures: Map<string, CapturedContent | null>;
65
+ brackets: BracketsManager;
66
+ flags: FlagsManager;
67
+ constructor(parser: CliParser);
68
+ resolveValues<T = unknown>(resolver: (captured: CapturedContent | null) => T): Map<string, T>;
69
+ }
70
+ export declare class CliParser {
71
+ context: CliParserRunContext;
72
+ constructor();
73
+ processBrackets(): this;
74
+ captureFlags(flags: IFlagCapture[]): this;
75
+ captureResidueFlags(): this;
76
+ setText(text: string): this;
77
+ captureResidue({ name }: {
78
+ name: string;
79
+ }): this;
80
+ replaceByMatch(regex: RegExp): RegExpMatchArray | null;
81
+ captureByMatch({ regex, name }: ITextMatch): this;
82
+ replaceTextByIndexes(start: number, length: number, replacer: (string: string) => string): void;
83
+ collect(): CliParserRunContext;
84
+ static CliParserRunContext: typeof CliParserRunContext;
85
+ static CapturedContent: typeof CapturedContent;
86
+ static BracketsManager: typeof BracketsManager;
87
+ static FlagsManager: typeof FlagsManager;
88
+ }
89
+ export {};
@@ -0,0 +1,245 @@
1
+ /* eslint-disable @typescript-eslint/no-namespace */
2
+ import { BracketsParser } from "./BracketsParser.js";
3
+ class BracketsManager extends BracketsParser {
4
+ constructor() {
5
+ super();
6
+ this.primary = [];
7
+ this.addBracketVariant(...BracketsParser.defaultBracketVariants);
8
+ }
9
+ parse() {
10
+ throw new Error("Use parseSafe instead");
11
+ }
12
+ parseSafe(text) {
13
+ const context = super.parse(text);
14
+ const { indexes } = this.useWriteToPrimaryProtocol(context);
15
+ return { indexes, context };
16
+ }
17
+ useWriteToPrimaryProtocol(context) {
18
+ const primary = this.findPrimaryGroups(context);
19
+ const indexes = [...new Array(primary.length)].map((_, index) => this.primary.length + index);
20
+ this.primary.push(...primary);
21
+ return { indexes };
22
+ }
23
+ toStringGroup(index) {
24
+ return `[Group*${index}]`;
25
+ }
26
+ findPrimaryGroups(context) {
27
+ return context.groups.filter((group) => group.depth === 0);
28
+ }
29
+ findBracketStamp(text) {
30
+ return text.trim().match(/^\[Group\*(?<index>\d+)\]$/);
31
+ }
32
+ processBracketGroupFromStringStamp(raw) {
33
+ const match = this.findBracketStamp(raw);
34
+ if (!match) {
35
+ return null;
36
+ }
37
+ const { index } = match.groups;
38
+ return this.primary.at(+index);
39
+ }
40
+ }
41
+ class FlagsManager {
42
+ captureResidueFlags(context) {
43
+ let match;
44
+ const { parser } = context;
45
+ while ((match = parser.replaceByMatch(/-{1,2}\w/))) {
46
+ this.unhandledFlags || (this.unhandledFlags = []);
47
+ this.unhandledFlags.push(match);
48
+ }
49
+ return this;
50
+ }
51
+ captureFlags(flags, context) {
52
+ for (const { name, capture, expectValue } of flags) {
53
+ for (const flag of capture) {
54
+ const regex = `(?<=^|\\s)${flag}${expectValue ? "(?:(?:\\s+|=)(?<value>[^\\s]+))" : ""}`;
55
+ const { parser } = context;
56
+ const captureName = name || flag;
57
+ const match = parser.replaceByMatch(RegExp(regex, "i"));
58
+ if (!match) {
59
+ context.captures.set(`${captureName}`, null);
60
+ continue;
61
+ }
62
+ context.captures.set(`${captureName}`, new CapturedContent(match).setContextInstance(context));
63
+ }
64
+ }
65
+ return this;
66
+ }
67
+ }
68
+ class CapturedContent {
69
+ constructor(content) {
70
+ this.content = content;
71
+ }
72
+ setContextInstance(context) {
73
+ this.context = context;
74
+ return this;
75
+ }
76
+ isRegexMatchArray() {
77
+ return CapturedContent.contentIsRegExpMatchArray(this.content);
78
+ }
79
+ isString() {
80
+ return CapturedContent.contentIsString(this.content);
81
+ }
82
+ isBracketGroupStamp() {
83
+ const { content, context } = this;
84
+ if (!context) {
85
+ throw new Error("context is undefined or null");
86
+ }
87
+ return CapturedContent.contentIsBracketGroupStamp(content, context);
88
+ }
89
+ toGroupElement() {
90
+ const { content, context } = this;
91
+ if (!context) {
92
+ throw new Error("context is undefined or null");
93
+ }
94
+ return CapturedContent.contentToGroupElement(content, context);
95
+ }
96
+ toString(addable = {}) {
97
+ return CapturedContent.contentToString(this.content, this.context, addable);
98
+ }
99
+ regexArrayOrStringToString() {
100
+ return CapturedContent.regexArrayOrStringToString(this.content);
101
+ }
102
+ static contentIsRegExpMatchArray(content) {
103
+ return (content instanceof Array &&
104
+ Object.prototype.hasOwnProperty.call(content, "index") &&
105
+ Object.prototype.hasOwnProperty.call(content, "input"));
106
+ }
107
+ static contentIsString(content) {
108
+ return typeof content === "string";
109
+ }
110
+ static contentIsBracketGroupStamp(content, context) {
111
+ const { brackets } = context || {};
112
+ if (!brackets) {
113
+ return null;
114
+ }
115
+ if (!content) {
116
+ return false;
117
+ }
118
+ content = this.regexArrayOrStringToString(content);
119
+ return !!brackets.findBracketStamp(content);
120
+ }
121
+ static contentToGroupElement(content, context) {
122
+ content = this.regexArrayOrStringToString(content);
123
+ const { brackets } = context || {};
124
+ return brackets.processBracketGroupFromStringStamp(content);
125
+ }
126
+ static regexArrayOrStringToString(content) {
127
+ var _a;
128
+ if (this.contentIsString(content)) {
129
+ return content;
130
+ }
131
+ return ((_a = content.groups) === null || _a === void 0 ? void 0 : _a.value) || content[0];
132
+ }
133
+ static contentToString(content, context, { trim = true, smart = true } = {}) {
134
+ let value = ((content) => {
135
+ var _a;
136
+ if (!smart) {
137
+ return String(content);
138
+ }
139
+ if (this.contentIsRegExpMatchArray(content)) {
140
+ content = this.regexArrayOrStringToString(content);
141
+ }
142
+ if (context && this.contentIsBracketGroupStamp(content, context)) {
143
+ return ((_a = this.contentToGroupElement(content, context)) === null || _a === void 0 ? void 0 : _a.full) || content;
144
+ }
145
+ return content;
146
+ })(content);
147
+ if (trim) {
148
+ value = value === null || value === void 0 ? void 0 : value.trim();
149
+ }
150
+ return value;
151
+ }
152
+ }
153
+ class CliParserRunContext {
154
+ constructor(parser) {
155
+ this.input = "";
156
+ this.captures = new Map();
157
+ this.brackets = new BracketsManager();
158
+ this.flags = new FlagsManager();
159
+ this.parser = parser;
160
+ }
161
+ resolveValues(resolver) {
162
+ const map = new Map();
163
+ const captures = this.captures;
164
+ for (const key of captures.keys()) {
165
+ const value = resolver(captures.get(key));
166
+ map.set(key, value);
167
+ }
168
+ return map;
169
+ }
170
+ }
171
+ export class CliParser {
172
+ constructor() {
173
+ this.context = new CliParserRunContext(this);
174
+ }
175
+ // replace brackets to [Bracket*n]
176
+ processBrackets() {
177
+ const { context } = this;
178
+ const { context: bracketsContext, indexes } = context.brackets.parseSafe(context.input);
179
+ const groups = context.brackets.findPrimaryGroups(bracketsContext);
180
+ let offset = 0;
181
+ for (const index in groups) {
182
+ const group = groups[index];
183
+ const replacement = context.brackets.toStringGroup(indexes[index]);
184
+ const length = group.length;
185
+ this.replaceTextByIndexes(group.indexInText - offset, length, () => replacement);
186
+ offset += length - replacement.length;
187
+ }
188
+ return this;
189
+ }
190
+ captureFlags(flags) {
191
+ const { context } = this;
192
+ context.flags.captureFlags(flags, context);
193
+ return this;
194
+ }
195
+ captureResidueFlags() {
196
+ const { context } = this;
197
+ context.flags.captureResidueFlags(context);
198
+ return this;
199
+ }
200
+ setText(text) {
201
+ const { context } = this;
202
+ context.input = text;
203
+ return this;
204
+ }
205
+ captureResidue({ name }) {
206
+ const { context } = this;
207
+ const text = context.input;
208
+ this.replaceTextByIndexes(0, text.length, () => "");
209
+ context.captures.set(name, new CapturedContent(text).setContextInstance(context));
210
+ return this;
211
+ }
212
+ replaceByMatch(regex) {
213
+ const { context } = this;
214
+ const matched = context.input.match(regex);
215
+ if (!matched) {
216
+ return null;
217
+ }
218
+ const [indexInText, full] = [matched.index, matched[0]];
219
+ if (indexInText === undefined) {
220
+ throw new Error("Match without index");
221
+ }
222
+ this.replaceTextByIndexes(indexInText, full.length, () => "");
223
+ return matched;
224
+ }
225
+ captureByMatch({ regex, name }) {
226
+ const { context } = this;
227
+ const matched = this.replaceByMatch(regex);
228
+ context.captures.set(name, matched ? new CapturedContent(matched).setContextInstance(context) : null);
229
+ return this;
230
+ }
231
+ replaceTextByIndexes(start, length, replacer) {
232
+ const { context } = this;
233
+ const before = context.input.slice(0, start);
234
+ const after = context.input.slice(start + length);
235
+ const replaced = replacer(context.input.slice(start, start + length));
236
+ context.input = `${before}${replaced}${after}`;
237
+ }
238
+ collect() {
239
+ return this.context;
240
+ }
241
+ }
242
+ CliParser.CliParserRunContext = CliParserRunContext;
243
+ CliParser.CapturedContent = CapturedContent;
244
+ CliParser.BracketsManager = BracketsManager;
245
+ CliParser.FlagsManager = FlagsManager;
@@ -1,4 +1,6 @@
1
- export * from './TextTableBuilder.js';
1
+ export * from "./TextTableBuilder.js";
2
+ export * from "./BracketsParser.js";
3
+ export * from "./CliParser.js";
2
4
  interface IEndingOptions {
3
5
  unite?: (quantity: number, word: string) => string;
4
6
  }
@@ -1,4 +1,6 @@
1
- export * from './TextTableBuilder.js';
1
+ export * from "./TextTableBuilder.js";
2
+ export * from "./BracketsParser.js";
3
+ export * from "./CliParser.js";
2
4
  function ending(quantity = 0, base, multiple, alone, double, options = {}) {
3
5
  if (isNaN(quantity))
4
6
  return NaN;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zoodogood/utils",
3
3
  "type": "module",
4
- "version": "1.1.3-change.1055",
4
+ "version": "1.2.0-change.1444",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -10,8 +10,10 @@
10
10
  "test": "vitest run",
11
11
  "docs-build": "cd ./docs && retype build --output ./public",
12
12
  "docs-watch": "cd ./docs && retype watch",
13
- "prepack": "yarn build && yarn test",
14
- "build": "tsc"
13
+ "prepack": "yarn build && yarn test && yarn docs-build",
14
+ "build": "tsc",
15
+ "tsc": "tsc",
16
+ "vitest": "vitest"
15
17
  },
16
18
  "typings": "lib/index",
17
19
  "exports": {
@@ -32,6 +34,7 @@
32
34
  "@types/node": "^20.5.9",
33
35
  "@typescript-eslint/eslint-plugin": "^6.13.1",
34
36
  "@typescript-eslint/parser": "^6.13.1",
37
+ "@vitest/ui": "^1.2.1",
35
38
  "discord-api-types": "^0.37.65",
36
39
  "discord.js": "^14.13.0",
37
40
  "eslint": "^8.54.0",