@budsbox/lib-es 2.2.0 → 3.0.0
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/dist/array.d.ts +49 -27
- package/dist/array.js +32 -20
- package/dist/function.d.ts +101 -0
- package/dist/function.js +38 -0
- package/dist/guards/assert.d.ts +213 -0
- package/dist/guards/assert.js +245 -0
- package/dist/guards/check.d.ts +470 -0
- package/dist/guards/check.js +524 -0
- package/dist/guards/describe.d.ts +7 -0
- package/dist/guards/describe.js +34 -0
- package/dist/guards/format.d.ts +109 -0
- package/dist/guards/format.js +295 -0
- package/dist/guards/hlf.d.ts +257 -0
- package/dist/guards/hlf.js +178 -0
- package/dist/guards/index.d.ts +73 -0
- package/dist/guards/index.js +124 -0
- package/dist/guards/message.d.ts +102 -0
- package/dist/guards/message.js +224 -0
- package/dist/guards/prop.d.ts +232 -0
- package/dist/guards/prop.js +45 -0
- package/dist/guards/types.d.ts +256 -0
- package/dist/guards/types.js +2 -0
- package/dist/logical.d.ts +23 -15
- package/dist/logical.js +14 -35
- package/dist/map.d.ts +48 -0
- package/dist/map.js +74 -0
- package/dist/object.d.ts +93 -14
- package/dist/object.js +61 -22
- package/dist/set.d.ts +70 -0
- package/dist/set.js +116 -0
- package/dist/string.d.ts +61 -35
- package/dist/string.js +98 -12
- package/dist/types.d.ts +66 -81
- package/package.json +76 -103
- package/dist/class-name.d.ts +0 -2
- package/dist/class-name.js +0 -2
- package/dist/guards.d.ts +0 -195
- package/dist/guards.js +0 -136
- package/dist/random.d.ts +0 -19
- package/dist/random.js +0 -35
package/dist/string.js
CHANGED
|
@@ -1,27 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable jsdoc/informative-docs */
|
|
2
|
+
import { assertArray, assertBoolean, assertNotNil, assertObject, assertOptionalProp, assertProp, assertSome, assertString, isBoolean, isNil, isNotNil, isNumber, isObject, isPropKey, isString, isUndef, somePredicate, } from '#guards';
|
|
3
|
+
import { joinWithConjunction as _joinWithConjunction, formatAccessString, } from '#guards/format';
|
|
2
4
|
/**
|
|
3
5
|
* Parses a package name string to extract its scope and name.
|
|
4
6
|
*
|
|
5
7
|
* @param packageName - The full name of the package, potentially including a scope.
|
|
6
8
|
* @param clean - A flag indicating whether to return a cleaned version (i.e., without a leading `@` and trailing `/`) of the scope. Defaults to false.
|
|
7
9
|
* @returns An object containing the parsed scope and name of the package. The scope will be `null` if no scope is present.
|
|
10
|
+
* @category Package Name
|
|
8
11
|
*/
|
|
9
12
|
export function parsePackageName(packageName, clean = false) {
|
|
13
|
+
assertString(packageName, 'packageName');
|
|
14
|
+
assertBoolean(clean, 'clean');
|
|
10
15
|
const [scope, cleanScope] = /^@([^/]+)\//.exec(packageName) ?? [null, null];
|
|
11
16
|
return {
|
|
12
17
|
scope: clean ? cleanScope : scope,
|
|
13
18
|
name: packageName.replace(scope ?? '', ''),
|
|
14
19
|
};
|
|
15
20
|
}
|
|
21
|
+
function normalizePackageName(ident, clean) {
|
|
22
|
+
assertSome(ident, 'ident', isString, isObject);
|
|
23
|
+
if (isObject(ident)) {
|
|
24
|
+
assertProp(ident, 'name', isString);
|
|
25
|
+
assertOptionalProp(ident, 'scope', somePredicate(isString, isNil));
|
|
26
|
+
return {
|
|
27
|
+
...ident,
|
|
28
|
+
scope: ident.scope ?? null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return parsePackageName(ident, clean);
|
|
32
|
+
}
|
|
16
33
|
export function serializePackageName(parsedPackageName, allowNil = false) {
|
|
17
|
-
if (!allowNil
|
|
18
|
-
|
|
34
|
+
if (!allowNil) {
|
|
35
|
+
assertNotNil(parsedPackageName, 'parsedPackageName');
|
|
19
36
|
}
|
|
20
|
-
const { scope, name } = parsedPackageName ?? { scope: null, name: '' };
|
|
37
|
+
const { scope, name } = normalizePackageName(parsedPackageName ?? { scope: null, name: '' });
|
|
21
38
|
return joinPath(scope?.replace(/^@?/, '@'), name);
|
|
22
39
|
}
|
|
23
40
|
export function resolvePackageName(ident, { baseScope, parsed = false, } = {}) {
|
|
24
|
-
const { scope, name } =
|
|
41
|
+
const { scope, name } = normalizePackageName(ident);
|
|
25
42
|
const parsedIdent = {
|
|
26
43
|
scope: scope ?? baseScope ?? null,
|
|
27
44
|
name,
|
|
@@ -40,15 +57,32 @@ export function resolvePackageName(ident, { baseScope, parsed = false, } = {}) {
|
|
|
40
57
|
* @param options.nameDelimiter - The delimiter used to separate parents name from the base name of the package. Defaults to `'_'`.
|
|
41
58
|
* @param options.excludePathChunks - Array of path chunks to be excluded when constructing the path. Defaults to `['packages']`.
|
|
42
59
|
* @returns The formatted package name as a string.
|
|
60
|
+
* @category Package Name
|
|
43
61
|
*/
|
|
44
|
-
export function formatPackageName(base,
|
|
62
|
+
export function formatPackageName(base, options = {}) {
|
|
63
|
+
assertString(base, 'base');
|
|
64
|
+
assertObject(options, 'options');
|
|
65
|
+
['root', 'parent'].forEach((key) => {
|
|
66
|
+
assertOptionalProp(options, key, somePredicate(isString, isNil), 'options');
|
|
67
|
+
});
|
|
68
|
+
['relCwd', 'pathDelimiter', 'nameDelimiter'].forEach((key) => {
|
|
69
|
+
assertOptionalProp(options, key, somePredicate(isString, isUndef), 'options');
|
|
70
|
+
});
|
|
71
|
+
const { root = null, parent = root, relCwd = '', pathDelimiter = '-', nameDelimiter = '_', excludePathChunks = ['packages'], } = options;
|
|
72
|
+
assertArray(excludePathChunks, isString, 'excludePathChunks');
|
|
73
|
+
[
|
|
74
|
+
['relCwd', relCwd],
|
|
75
|
+
['pathDelimiter', pathDelimiter],
|
|
76
|
+
['nameDelimiter', nameDelimiter],
|
|
77
|
+
].forEach(([name, value]) => void assertString(value, name));
|
|
78
|
+
assertArray(excludePathChunks, isString, 'options.excludePathChunks');
|
|
45
79
|
const topLevel = parent === root;
|
|
46
80
|
const exclude = new Set(excludePathChunks);
|
|
47
81
|
const pathChunks = splitPath(relCwd).filter((chunk) => !exclude.has(chunk));
|
|
48
82
|
if (pathChunks.at(-1) === base) {
|
|
49
83
|
pathChunks.pop();
|
|
50
84
|
}
|
|
51
|
-
const { scope, name: parentName } =
|
|
85
|
+
const { scope, name: parentName } = normalizePackageName(parent ?? '');
|
|
52
86
|
return serializePackageName({
|
|
53
87
|
scope,
|
|
54
88
|
name: [
|
|
@@ -63,6 +97,7 @@ export function formatPackageName(base, { root = null, parent = root, relCwd = '
|
|
|
63
97
|
* @param value - The value to be converted to its string representation. Can be of any type.
|
|
64
98
|
* @returns A string representation of the input value.
|
|
65
99
|
* If the value cannot be serialized using JSON.stringify, it falls back to using String conversion.
|
|
100
|
+
* @deprecated Use `formatDebugValue` from `@budsbox/lib-es/guards` instead.
|
|
66
101
|
*/
|
|
67
102
|
export function debugString(value) {
|
|
68
103
|
try {
|
|
@@ -80,6 +115,7 @@ export function debugString(value) {
|
|
|
80
115
|
* @returns The processed string with trimmed and normalized whitespace.
|
|
81
116
|
*/
|
|
82
117
|
export function clampWS(str) {
|
|
118
|
+
assertString(str, 'str');
|
|
83
119
|
return str.trim().replace(/\s+/g, ' ');
|
|
84
120
|
}
|
|
85
121
|
/**
|
|
@@ -90,8 +126,10 @@ export function clampWS(str) {
|
|
|
90
126
|
* @param parts - An array of path parts to join. Each part can be a string, number, boolean, null, or undefined.
|
|
91
127
|
* Non-string values will be serialized, and null/undefined values are ignored.
|
|
92
128
|
* @returns The combined path as a single string, with proper slash formatting.
|
|
129
|
+
* @category Paths
|
|
93
130
|
*/
|
|
94
131
|
export function joinPath(...parts) {
|
|
132
|
+
assertArray(parts, somePredicate(isString, isNumber, isBoolean, isNil), 'parts');
|
|
95
133
|
return parts
|
|
96
134
|
.filter(isNotNil)
|
|
97
135
|
.reduce((acc, part) => acc.length === 0 ?
|
|
@@ -106,20 +144,38 @@ export function joinPath(...parts) {
|
|
|
106
144
|
* @param keepEmptyChunks - A boolean indicating whether empty strings (resulting from consecutive delimiters)
|
|
107
145
|
* should be preserved in the output array. Defaults to `false`.
|
|
108
146
|
* @returns An array of strings representing the components of the path.
|
|
147
|
+
* @category Paths
|
|
109
148
|
*/
|
|
110
149
|
export function splitPath(path, keepEmptyChunks = false) {
|
|
111
|
-
|
|
150
|
+
assertString(path, 'path');
|
|
151
|
+
assertBoolean(keepEmptyChunks, 'keepEmptyChunks');
|
|
152
|
+
const splitted = path.split(keepEmptyChunks ? '/' : /\/+/);
|
|
112
153
|
return keepEmptyChunks ? splitted : (splitted.filter((chunk) => chunk.length > 0));
|
|
113
154
|
}
|
|
114
155
|
export function camelCase(name) {
|
|
115
|
-
|
|
156
|
+
assertString(name, 'name');
|
|
157
|
+
return clampWS(name)
|
|
158
|
+
.replace(/[-_\s]+([^-_\s])/g, (_, suffix) => suffix.toUpperCase())
|
|
159
|
+
.replace(/^./, (char) => char.toLowerCase())
|
|
160
|
+
.replace(/[-_\s]+/g, '');
|
|
116
161
|
}
|
|
117
162
|
export function pascalCase(name) {
|
|
118
|
-
return camelCase(name).replace(/^./, (
|
|
163
|
+
return camelCase(name).replace(/^./, (char) => char.toUpperCase());
|
|
119
164
|
}
|
|
120
165
|
export function delimCase(name, delimiter = '-') {
|
|
121
|
-
|
|
122
|
-
|
|
166
|
+
assertString(name, 'name');
|
|
167
|
+
assertString(delimiter, 'delimiter');
|
|
168
|
+
const clamped = clampWS(name);
|
|
169
|
+
const chars = [];
|
|
170
|
+
for (let i = 0; i < clamped.length; i++) {
|
|
171
|
+
const char = clamped[i];
|
|
172
|
+
if (/^[A-Z]$/.test(char) && i !== 0) {
|
|
173
|
+
chars.push(delimiter);
|
|
174
|
+
}
|
|
175
|
+
chars.push(char);
|
|
176
|
+
}
|
|
177
|
+
return chars
|
|
178
|
+
.join('')
|
|
123
179
|
.replace(/[-_\s]+/g, delimiter)
|
|
124
180
|
.toLowerCase();
|
|
125
181
|
}
|
|
@@ -129,4 +185,34 @@ export function kebabCase(name) {
|
|
|
129
185
|
export function snakeCase(name) {
|
|
130
186
|
return delimCase(name, '_');
|
|
131
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Joins an array of strings into a single formatted string using the specified conjunction.
|
|
190
|
+
*
|
|
191
|
+
* @param items - An array of strings to be joined. If the array is empty, an empty string is returned.
|
|
192
|
+
* @param conjunction - A word or phrase (`and` or `or`) to be used as the conjunction between the last two items.
|
|
193
|
+
* @returns A formatted string where the items are separated by commas and the conjunction is added before the final item.
|
|
194
|
+
*/
|
|
195
|
+
export function joinWithConjunction(items, conjunction) {
|
|
196
|
+
assertArray(items, isString, 'items');
|
|
197
|
+
assertString(conjunction, 'conjunction');
|
|
198
|
+
return _joinWithConjunction(items, conjunction);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Constructs a dot-notation or bracket-notation string representation
|
|
202
|
+
* for accessing nested properties of an object based on the provided keys.
|
|
203
|
+
*
|
|
204
|
+
* @internal
|
|
205
|
+
* @param sourceName - The base name of the object or source from which properties are being accessed.
|
|
206
|
+
* @param keys - A variadic list of property keys representing the nested path.
|
|
207
|
+
* Each key will be used to generate the accessor string.
|
|
208
|
+
* @returns A string representing the accessor path in dot-notation for valid identifiers
|
|
209
|
+
* or bracket-notation for non-identifier keys.
|
|
210
|
+
* @remarks This function considers "valid" for identifiers only alphanumeric characters,
|
|
211
|
+
* underscores, and dollar signs.
|
|
212
|
+
*/
|
|
213
|
+
export function formatPropAccessor(sourceName, ...keys) {
|
|
214
|
+
assertString(sourceName, 'sourceName');
|
|
215
|
+
assertArray(keys, isPropKey, 'keys');
|
|
216
|
+
return formatAccessString(sourceName, ...keys);
|
|
217
|
+
}
|
|
132
218
|
//# sourceMappingURL=string.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,94 +1,40 @@
|
|
|
1
|
+
import type { FValue, Maybe, Predicate, TypePredicate, Undef, ValuePredicate } from '@budsbox/lib-types';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
* that takes a parameter of type `A` and returns a value of type `T`.
|
|
3
|
+
* Resolves to a type based on a predicate or type guard and the selected branch.
|
|
4
4
|
*
|
|
5
|
-
* @typeParam
|
|
6
|
-
* @typeParam
|
|
5
|
+
* @typeParam TValue - The value type under test.
|
|
6
|
+
* @typeParam TTestFn - A `Predicate` or `TypePredicate` applied to `TValue`.
|
|
7
|
+
* @typeParam TBranch - If `true`, keep the narrowed part; if `false`, exclude it.
|
|
7
8
|
*/
|
|
8
|
-
export type
|
|
9
|
+
export type TestFnResult<TValue, TTestFn extends Predicate, TBranch extends boolean> = TTestFn extends TypePredicate<unknown, infer TNarrowed> ? TBranch extends true ? Extract<TValue, TNarrowed> : Exclude<TValue, TNarrowed> : TTestFn extends ValuePredicate<infer TOriginal> ? TOriginal : never;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
* conforms to a more specific type `V`, where `V` is a subtype of `T`.
|
|
11
|
+
* Maps the "true" branch of a test to a value or function result type.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @typeParam T - The broader type against which the value will be checked.
|
|
18
|
-
* @typeParam V - The narrowed type that `T` is tested against. V must extend T.
|
|
19
|
-
* @param value - The value of type `T` to be tested against the narrowed type `V`.
|
|
20
|
-
* @returns A boolean value indicating whether the input value is of type `V`.
|
|
21
|
-
*/
|
|
22
|
-
export type TypeGuard<T, V extends T> = (value: T) => value is V;
|
|
23
|
-
/**
|
|
24
|
-
* A type definition for a function that performs a boolean test on a given value.
|
|
25
|
-
*
|
|
26
|
-
* This generic type accepts a parameter `T`, which represents the type of the input
|
|
27
|
-
* that the function will evaluate. The function returns a boolean indicating the
|
|
28
|
-
* result of the test.
|
|
29
|
-
*
|
|
30
|
-
* @typeParam T - The type of the input value that the function will evaluate.
|
|
31
|
-
* @param value - The input value to test.
|
|
32
|
-
* @returns A boolean indicating the result of the test.
|
|
33
|
-
*/
|
|
34
|
-
export type Predicate<T> = (value: T) => boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Represents a type that can either be a `TypeGuard` or a `TestFn`.
|
|
37
|
-
*
|
|
38
|
-
* `TestParam` is a utility type that allows defining parameters used in testing or
|
|
39
|
-
* type-checking procedures. It accommodates both type guard functions and test
|
|
40
|
-
* functions for more comprehensive type handling.
|
|
41
|
-
*
|
|
42
|
-
* @typeParam TValue - The base type to be tested or narrowed. Defaults to `any`.
|
|
43
|
-
* @typeParam TNarrowed - A subtype of `ValueType` that represents the narrowed type.
|
|
44
|
-
* Defaults to `ValueType`.
|
|
45
|
-
*/
|
|
46
|
-
export type TestFn<TValue = any, TNarrowed extends TValue = TValue> = Predicate<TValue> | TypeGuard<TValue, TNarrowed>;
|
|
47
|
-
/**
|
|
48
|
-
* Represents a type that evaluates to a specific result based on the provided test conditions.
|
|
49
|
-
*
|
|
50
|
-
* @typeParam TValue - The type of value being tested.
|
|
51
|
-
* @typeParam TTestFn - The type of test being applied. This could be a type guard or a test function.
|
|
52
|
-
* @typeParam TBranch - A boolean that determines the branch type. If true, the resulting type will
|
|
53
|
-
* focus on the narrowed type; otherwise, it excludes the narrowed type.
|
|
54
|
-
*
|
|
55
|
-
* The type resolves based on the following rules:
|
|
56
|
-
* 1. If `TestType` is a type guard:
|
|
57
|
-
* - If `BranchType` is `true`, the resulting type includes only the portion of `ValueType` that
|
|
58
|
-
* conforms to the narrowed type.
|
|
59
|
-
* - If `BranchType` is `false`, the resulting type excludes the portion of `ValueType` that
|
|
60
|
-
* conforms to the narrowed type.
|
|
61
|
-
* 2. If `TestType` is a test function, the resulting type will be the original type inferred by
|
|
62
|
-
* the test function.
|
|
63
|
-
* 3. If neither condition applies, the resulting type will be `never`.
|
|
64
|
-
*/
|
|
65
|
-
export type TestFnResult<TValue, TTestFn extends TestFn, TBranch extends boolean> = TTestFn extends TypeGuard<unknown, infer TNarrowed> ? TBranch extends true ? Extract<TValue, TNarrowed> : Exclude<TValue, TNarrowed> : TTestFn extends Predicate<infer TOriginal> ? TOriginal : never;
|
|
66
|
-
/**
|
|
67
|
-
* A type definition that represents a resolved value when a certain test condition is true.
|
|
68
|
-
*
|
|
69
|
-
* @typeParam ValueType - Represents the type of the input value being tested.
|
|
70
|
-
* @typeParam TestType - Extends the `TestParam` type and defines the parameters for the test condition.
|
|
71
|
-
* @typeParam ReturnType - Specifies the type of the resulting value after the test condition is satisfied.
|
|
72
|
-
*
|
|
73
|
-
* This type combines the test result with a return type, capturing the transformed value
|
|
74
|
-
* or operation result when the test evaluates to `true`.
|
|
13
|
+
* @typeParam TValue - The input value type being tested.
|
|
14
|
+
* @typeParam TTestFn - The test (predicate or type guard).
|
|
15
|
+
* @typeParam TResult - The resulting value type.
|
|
75
16
|
*/
|
|
76
|
-
export type FValueTrue<TValue, TTestFn extends
|
|
17
|
+
export type FValueTrue<TValue, TTestFn extends Predicate, TResult> = FValue<TestFnResult<TValue, TTestFn, true>, TResult>;
|
|
77
18
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* This type is a utility that processes the result of a test operation (`TestResultType`)
|
|
81
|
-
* when the provided test condition evaluates as false, associating it with a specific return type (`ReturnType`).
|
|
19
|
+
* Maps the "false" branch of a test to a value or function result type.
|
|
82
20
|
*
|
|
83
|
-
* @typeParam
|
|
84
|
-
* @typeParam
|
|
85
|
-
* @typeParam
|
|
21
|
+
* @typeParam TValue - The input value type being tested.
|
|
22
|
+
* @typeParam TTestFn - The test (predicate or type guard).
|
|
23
|
+
* @typeParam TResult - The resulting value type.
|
|
86
24
|
*/
|
|
87
|
-
export type FValueFalse<TValue, TTestFn extends
|
|
25
|
+
export type FValueFalse<TValue, TTestFn extends Predicate, TResult> = FValue<TestFnResult<TValue, TTestFn, false>, TResult>;
|
|
88
26
|
/**
|
|
89
27
|
* Represents a parsed Node.js (npm) package name split into its optional scope and the bare name.
|
|
28
|
+
*
|
|
29
|
+
* @inline
|
|
30
|
+
* @category Package Name
|
|
90
31
|
*/
|
|
91
32
|
export interface ParsedPackageName {
|
|
33
|
+
/**
|
|
34
|
+
* The unscoped package name (the segment after the scope or the whole name if unscoped).
|
|
35
|
+
* For "@scope/pkg", this is "pkg"; for "pkg", this is "pkg".
|
|
36
|
+
*/
|
|
37
|
+
name: string;
|
|
92
38
|
/**
|
|
93
39
|
* The scope part of the package name (organization/user), with or without the leading "@" and trail "/".
|
|
94
40
|
* If the package is unscoped, this will be `null` or `undefined`.
|
|
@@ -96,10 +42,49 @@ export interface ParsedPackageName {
|
|
|
96
42
|
* @example "scope" for "@scope/pkg", or "undefined" for "pkg"
|
|
97
43
|
*/
|
|
98
44
|
scope?: string | null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Options for formatting the package name.
|
|
48
|
+
*
|
|
49
|
+
* @inline
|
|
50
|
+
* @category Package Name
|
|
51
|
+
*/
|
|
52
|
+
export interface PackageNameFormatOptions {
|
|
99
53
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
54
|
+
* Array of path chunks to be excluded when constructing the path.
|
|
55
|
+
*
|
|
56
|
+
* @defaultValue `['packages']`
|
|
102
57
|
*/
|
|
103
|
-
|
|
58
|
+
excludePathChunks?: Undef<readonly string[]>;
|
|
59
|
+
/**
|
|
60
|
+
* The delimiter used to separate parents name from the base name of the package.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue `'_'`
|
|
63
|
+
*/
|
|
64
|
+
nameDelimiter?: Undef<string>;
|
|
65
|
+
/**
|
|
66
|
+
* The parent package name.
|
|
67
|
+
*
|
|
68
|
+
* @defaultValue `options.root`
|
|
69
|
+
*/
|
|
70
|
+
parent?: Maybe<string>;
|
|
71
|
+
/**
|
|
72
|
+
* The delimiter used to separate path chunks.
|
|
73
|
+
*
|
|
74
|
+
* @defaultValue `'-'`
|
|
75
|
+
*/
|
|
76
|
+
pathDelimiter?: Undef<string>;
|
|
77
|
+
/**
|
|
78
|
+
* The path to the package, relative to its parent.
|
|
79
|
+
*
|
|
80
|
+
* @defaultValue `''`
|
|
81
|
+
*/
|
|
82
|
+
relCwd?: Undef<string>;
|
|
83
|
+
/**
|
|
84
|
+
* The root identifier for the package.
|
|
85
|
+
*
|
|
86
|
+
* @defaultValue `null`
|
|
87
|
+
*/
|
|
88
|
+
root?: Maybe<string>;
|
|
104
89
|
}
|
|
105
90
|
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,117 +1,86 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budsbox/lib-es",
|
|
3
|
-
"version": "
|
|
4
|
-
"homepage": "https://
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"homepage": "https://github.com/budsbox/seed",
|
|
5
5
|
"bugs": {
|
|
6
|
-
"url": "https://
|
|
6
|
+
"url": "https://github.com/budsbox/seed/issues"
|
|
7
7
|
},
|
|
8
|
-
"repository": "
|
|
8
|
+
"repository": "git@github.com:budsbox/seed.git",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"author": "Konstantin Kutsyllo <trikadin@pm.me>",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"imports": {
|
|
13
13
|
"#package.json": "./package.json",
|
|
14
|
+
"#types": "./dist/types.d.ts",
|
|
14
15
|
"#array": {
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"types": "./dist/array.d.ts"
|
|
18
|
-
},
|
|
19
|
-
"require": {
|
|
20
|
-
"default": "./dist/array.js",
|
|
21
|
-
"types": "./dist/array.d.ts"
|
|
22
|
-
}
|
|
16
|
+
"types": "./dist/array.d.ts",
|
|
17
|
+
"default": "./dist/array.js"
|
|
23
18
|
},
|
|
24
19
|
"#object": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"types": "./dist/object.d.ts"
|
|
28
|
-
},
|
|
29
|
-
"require": {
|
|
30
|
-
"default": "./dist/object.js",
|
|
31
|
-
"types": "./dist/object.d.ts"
|
|
32
|
-
}
|
|
20
|
+
"types": "./dist/object.d.ts",
|
|
21
|
+
"default": "./dist/object.js"
|
|
33
22
|
},
|
|
34
23
|
"#string": {
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
"types": "./dist/string.d.ts"
|
|
38
|
-
},
|
|
39
|
-
"require": {
|
|
40
|
-
"default": "./dist/string.js",
|
|
41
|
-
"types": "./dist/string.d.ts"
|
|
42
|
-
}
|
|
24
|
+
"types": "./dist/string.d.ts",
|
|
25
|
+
"default": "./dist/string.js"
|
|
43
26
|
},
|
|
44
27
|
"#guards": {
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
"types": "./dist/guards.d.ts"
|
|
52
|
-
}
|
|
28
|
+
"types": "./dist/guards/index.d.ts",
|
|
29
|
+
"default": "./dist/guards/index.js"
|
|
30
|
+
},
|
|
31
|
+
"#guards/*": {
|
|
32
|
+
"types": "./dist/guards/*.d.ts",
|
|
33
|
+
"default": "./dist/guards/*.js"
|
|
53
34
|
},
|
|
54
35
|
"#logical": {
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
36
|
+
"types": "./dist/logical.d.ts",
|
|
37
|
+
"default": "./dist/logical.js"
|
|
38
|
+
},
|
|
39
|
+
"#function": {
|
|
40
|
+
"types": "./dist/function.d.ts",
|
|
41
|
+
"default": "./dist/function.js"
|
|
42
|
+
},
|
|
43
|
+
"#set": {
|
|
44
|
+
"types": "./dist/set.d.ts",
|
|
45
|
+
"default": "./dist/set.js"
|
|
46
|
+
},
|
|
47
|
+
"#map": {
|
|
48
|
+
"types": "./dist/map.d.ts",
|
|
49
|
+
"default": "./dist/map.js"
|
|
63
50
|
}
|
|
64
51
|
},
|
|
65
52
|
"exports": {
|
|
66
53
|
"./array": {
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
"types": "./dist/array.d.ts"
|
|
70
|
-
},
|
|
71
|
-
"require": {
|
|
72
|
-
"default": "./dist/array.js",
|
|
73
|
-
"types": "./dist/array.d.ts"
|
|
74
|
-
}
|
|
54
|
+
"types": "./dist/array.d.ts",
|
|
55
|
+
"default": "./dist/array.js"
|
|
75
56
|
},
|
|
76
57
|
"./object": {
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
"types": "./dist/object.d.ts"
|
|
80
|
-
},
|
|
81
|
-
"require": {
|
|
82
|
-
"default": "./dist/object.js",
|
|
83
|
-
"types": "./dist/object.d.ts"
|
|
84
|
-
}
|
|
58
|
+
"types": "./dist/object.d.ts",
|
|
59
|
+
"default": "./dist/object.js"
|
|
85
60
|
},
|
|
86
61
|
"./string": {
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
"types": "./dist/string.d.ts"
|
|
90
|
-
},
|
|
91
|
-
"require": {
|
|
92
|
-
"default": "./dist/string.js",
|
|
93
|
-
"types": "./dist/string.d.ts"
|
|
94
|
-
}
|
|
62
|
+
"types": "./dist/string.d.ts",
|
|
63
|
+
"default": "./dist/string.js"
|
|
95
64
|
},
|
|
96
65
|
"./guards": {
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
"types": "./dist/guards.d.ts"
|
|
100
|
-
},
|
|
101
|
-
"require": {
|
|
102
|
-
"default": "./dist/guards.js",
|
|
103
|
-
"types": "./dist/guards.d.ts"
|
|
104
|
-
}
|
|
66
|
+
"types": "./dist/guards/index.d.ts",
|
|
67
|
+
"default": "./dist/guards/index.js"
|
|
105
68
|
},
|
|
106
69
|
"./logical": {
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
70
|
+
"types": "./dist/logical.d.ts",
|
|
71
|
+
"default": "./dist/logical.js"
|
|
72
|
+
},
|
|
73
|
+
"./function": {
|
|
74
|
+
"types": "./dist/function.d.ts",
|
|
75
|
+
"default": "./dist/function.js"
|
|
76
|
+
},
|
|
77
|
+
"./set": {
|
|
78
|
+
"types": "./dist/set.d.ts",
|
|
79
|
+
"default": "./dist/set.js"
|
|
80
|
+
},
|
|
81
|
+
"./map": {
|
|
82
|
+
"types": "./dist/map.d.ts",
|
|
83
|
+
"default": "./dist/map.js"
|
|
115
84
|
},
|
|
116
85
|
"./package.json": "./package.json"
|
|
117
86
|
},
|
|
@@ -120,34 +89,38 @@
|
|
|
120
89
|
"dist/**/*.js"
|
|
121
90
|
],
|
|
122
91
|
"scripts": {
|
|
92
|
+
"build": "run p:ts:build",
|
|
123
93
|
"name": "echo $npm_package_name",
|
|
124
|
-
"prepack": "yarn p:ts:prepack"
|
|
94
|
+
"prepack": "yarn p:ts:prepack",
|
|
95
|
+
"test": "run p:vitest",
|
|
96
|
+
"watch": "yarn p:ts:watch"
|
|
125
97
|
},
|
|
126
98
|
"dependencies": {
|
|
127
|
-
"@budsbox/lib-types": "^1.
|
|
128
|
-
"@types/node": "^22.
|
|
99
|
+
"@budsbox/lib-types": "^1.4.0",
|
|
100
|
+
"@types/node": "^22.19.1",
|
|
129
101
|
"tslib": "^2.8.1",
|
|
130
|
-
"type-fest": "^
|
|
102
|
+
"type-fest": "^5.3.1"
|
|
131
103
|
},
|
|
132
104
|
"devDependencies": {
|
|
133
|
-
"@budsbox/eslint": "^1.
|
|
134
|
-
"@budsbox/eslint_presets-lib": "^1.0.
|
|
135
|
-
"@budsbox/eslint_presets-tools": "^1.0.
|
|
136
|
-
"@budsbox/tsconfigs": "^4.
|
|
137
|
-
"@eslint/js": "^9.
|
|
105
|
+
"@budsbox/eslint": "^1.3.0",
|
|
106
|
+
"@budsbox/eslint_presets-lib": "^1.0.5",
|
|
107
|
+
"@budsbox/eslint_presets-tools": "^1.0.5",
|
|
108
|
+
"@budsbox/tsconfigs": "^4.4.0",
|
|
109
|
+
"@eslint/js": "^9.39.1",
|
|
138
110
|
"@types/eslint": "^9.6.1",
|
|
139
|
-
"@typescript-eslint/parser": "^8.
|
|
140
|
-
"eslint": "^9.
|
|
141
|
-
"eslint-config-prettier": "^10.1.
|
|
142
|
-
"eslint-import-resolver-typescript": "^4.
|
|
143
|
-
"eslint-plugin-import-x": "^4.
|
|
144
|
-
"eslint-plugin-jsdoc": "^
|
|
111
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
112
|
+
"eslint": "^9.39.1",
|
|
113
|
+
"eslint-config-prettier": "^10.1.8",
|
|
114
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
115
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
116
|
+
"eslint-plugin-jsdoc": "^61.5.0",
|
|
145
117
|
"eslint-plugin-react": "^7.37.5",
|
|
146
118
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
147
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
148
|
-
"globals": "^16.
|
|
149
|
-
"typescript": "^5.
|
|
150
|
-
"typescript-eslint": "^8.
|
|
119
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
120
|
+
"globals": "^16.5.0",
|
|
121
|
+
"typescript": "^5.9.3",
|
|
122
|
+
"typescript-eslint": "^8.48.1",
|
|
123
|
+
"vitest": "^4.1.0"
|
|
151
124
|
},
|
|
152
125
|
"packageManager": "yarn@4.9.2"
|
|
153
126
|
}
|
package/dist/class-name.d.ts
DELETED
package/dist/class-name.js
DELETED