@dereekb/util 13.11.14 → 13.11.15
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/eslint/index.cjs.js +10008 -394
- package/eslint/index.esm.js +9982 -392
- package/eslint/package.json +4 -4
- package/eslint/src/lib/comments.d.ts +14 -3
- package/eslint/src/lib/dbx-tag-families.d.ts +280 -0
- package/eslint/src/lib/index.d.ts +26 -3
- package/eslint/src/lib/jsdoc-parser.d.ts +116 -0
- package/eslint/src/lib/no-inline-string-empty-object-intersection.rule.d.ts +44 -0
- package/eslint/src/lib/no-inline-type-import.rule.d.ts +38 -0
- package/eslint/src/lib/no-sister-re-export.rule.d.ts +69 -0
- package/eslint/src/lib/plugin.d.ts +52 -1
- package/eslint/src/lib/prefer-canonical-jsdoc.rule.d.ts +68 -0
- package/eslint/src/lib/prefer-config-object.rule.d.ts +61 -0
- package/eslint/src/lib/prefer-maybe-type.rule.d.ts +72 -0
- package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +1 -1
- package/eslint/src/lib/prefer-suggested-string.rule.d.ts +51 -0
- package/eslint/src/lib/require-constant-naming.rule.d.ts +63 -0
- package/eslint/src/lib/require-dbx-action-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-auth-companion-tags.rule.d.ts +45 -0
- package/eslint/src/lib/require-dbx-docs-ui-example-companion-tags.rule.d.ts +42 -0
- package/eslint/src/lib/require-dbx-filter-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-form-field-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-firebase-index-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-model-snapshot-field-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-pipe-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-rule-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-util-companion-tags.rule.d.ts +74 -0
- package/eslint/src/lib/require-dbx-web-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-default-prefix-naming.rule.d.ts +60 -0
- package/eslint/src/lib/require-deprecated-alias-placement.rule.d.ts +75 -0
- package/eslint/src/lib/require-exported-jsdoc-example.rule.d.ts +61 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +1 -1
- package/eslint/src/lib/require-readonly-config-params.rule.d.ts +57 -0
- package/eslint/src/lib/require-single-return.rule.d.ts +42 -0
- package/fetch/index.cjs.js +95 -80
- package/fetch/index.esm.js +95 -80
- package/fetch/package.json +2 -2
- package/fetch/src/lib/error.d.ts +2 -2
- package/fetch/src/lib/fetch.d.ts +15 -15
- package/fetch/src/lib/fetch.file.d.ts +5 -5
- package/fetch/src/lib/fetch.limit.d.ts +2 -2
- package/fetch/src/lib/fetch.page.d.ts +1 -1
- package/fetch/src/lib/fetch.page.iterate.d.ts +4 -4
- package/fetch/src/lib/fetch.type.d.ts +3 -2
- package/fetch/src/lib/fetch.url.d.ts +13 -13
- package/fetch/src/lib/json.d.ts +12 -12
- package/fetch/src/lib/timeout.d.ts +2 -2
- package/fetch/src/lib/url.d.ts +11 -11
- package/index.cjs.js +2592 -2329
- package/index.esm.js +2590 -2327
- package/package.json +1 -1
- package/src/lib/array/array.boolean.d.ts +20 -20
- package/src/lib/array/array.d.ts +73 -72
- package/src/lib/array/array.factory.d.ts +8 -5
- package/src/lib/array/array.filter.d.ts +23 -20
- package/src/lib/array/array.find.d.ts +9 -8
- package/src/lib/array/array.index.d.ts +15 -14
- package/src/lib/array/array.indexed.d.ts +22 -19
- package/src/lib/array/array.make.d.ts +3 -2
- package/src/lib/array/array.map.d.ts +5 -5
- package/src/lib/array/array.number.d.ts +27 -27
- package/src/lib/array/array.random.d.ts +11 -10
- package/src/lib/array/array.set.d.ts +14 -14
- package/src/lib/array/array.string.d.ts +31 -31
- package/src/lib/array/array.unique.d.ts +22 -20
- package/src/lib/array/array.value.d.ts +3 -2
- package/src/lib/assertion/assert.error.d.ts +8 -8
- package/src/lib/assertion/assertion.d.ts +5 -5
- package/src/lib/assertion/assertion.generic.d.ts +3 -3
- package/src/lib/assertion/assertion.number.d.ts +6 -6
- package/src/lib/auth/auth.role.claims.d.ts +12 -11
- package/src/lib/auth/auth.role.d.ts +3 -3
- package/src/lib/auth/pkce.d.ts +2 -2
- package/src/lib/boolean.d.ts +11 -11
- package/src/lib/cache/cache.memoize.d.ts +6 -6
- package/src/lib/contact/domain.d.ts +9 -9
- package/src/lib/contact/email.d.ts +11 -11
- package/src/lib/contact/phone.d.ts +12 -12
- package/src/lib/contact/random.d.ts +11 -9
- package/src/lib/date/date.d.ts +60 -59
- package/src/lib/date/date.time.d.ts +2 -2
- package/src/lib/date/date.unix.d.ts +8 -8
- package/src/lib/date/duration.d.ts +17 -17
- package/src/lib/date/expires.d.ts +29 -27
- package/src/lib/date/hour.d.ts +23 -23
- package/src/lib/date/minute.d.ts +6 -6
- package/src/lib/date/time.d.ts +10 -9
- package/src/lib/date/week.d.ts +32 -31
- package/src/lib/encryption/encryption.object.d.ts +3 -3
- package/src/lib/error/error.d.ts +13 -12
- package/src/lib/error/error.server.d.ts +4 -4
- package/src/lib/file/pdf.d.ts +4 -4
- package/src/lib/filter/filter.d.ts +3 -2
- package/src/lib/function/function.boolean.d.ts +4 -3
- package/src/lib/function/function.forward.d.ts +6 -4
- package/src/lib/getter/getter.d.ts +24 -19
- package/src/lib/getter/getter.map.d.ts +6 -5
- package/src/lib/getter/getter.util.d.ts +3 -2
- package/src/lib/grouping.d.ts +25 -24
- package/src/lib/hash.d.ts +11 -10
- package/src/lib/iterable/iterable.d.ts +39 -39
- package/src/lib/iterable/iterable.map.d.ts +3 -3
- package/src/lib/key.d.ts +16 -16
- package/src/lib/map/map.d.ts +12 -12
- package/src/lib/map/map.intersection.d.ts +3 -3
- package/src/lib/map/map.key.d.ts +16 -14
- package/src/lib/misc/host.d.ts +2 -2
- package/src/lib/model/id.batch.d.ts +4 -3
- package/src/lib/model/id.factory.d.ts +4 -3
- package/src/lib/model/model.conversion.d.ts +19 -14
- package/src/lib/model/model.conversion.field.d.ts +2 -2
- package/src/lib/model/model.copy.d.ts +5 -4
- package/src/lib/model/model.d.ts +48 -46
- package/src/lib/model/model.modify.d.ts +10 -8
- package/src/lib/nodejs/stream.d.ts +6 -5
- package/src/lib/number/bitwise.dencoder.d.ts +12 -12
- package/src/lib/number/bound.d.ts +16 -13
- package/src/lib/number/dollar.d.ts +6 -5
- package/src/lib/number/encoded.d.ts +7 -7
- package/src/lib/number/factory.d.ts +4 -3
- package/src/lib/number/number.d.ts +37 -37
- package/src/lib/number/random.d.ts +11 -10
- package/src/lib/number/round.d.ts +34 -30
- package/src/lib/number/sort.d.ts +3 -2
- package/src/lib/number/transform.d.ts +5 -4
- package/src/lib/object/object.array.d.ts +6 -6
- package/src/lib/object/object.array.delta.d.ts +3 -2
- package/src/lib/object/object.d.ts +12 -12
- package/src/lib/object/object.empty.d.ts +3 -3
- package/src/lib/object/object.equal.d.ts +11 -10
- package/src/lib/object/object.filter.pojo.d.ts +74 -74
- package/src/lib/object/object.filter.tuple.d.ts +26 -26
- package/src/lib/object/object.flatten.d.ts +4 -4
- package/src/lib/object/object.key.d.ts +6 -4
- package/src/lib/object/object.map.d.ts +15 -13
- package/src/lib/page/page.d.ts +5 -5
- package/src/lib/page/page.filter.d.ts +8 -8
- package/src/lib/path/path.d.ts +98 -88
- package/src/lib/promise/callback.d.ts +2 -2
- package/src/lib/promise/is.d.ts +6 -6
- package/src/lib/promise/poll.d.ts +9 -9
- package/src/lib/promise/promise.d.ts +33 -30
- package/src/lib/promise/promise.factory.d.ts +4 -3
- package/src/lib/promise/promise.loop.d.ts +11 -11
- package/src/lib/promise/promise.task.d.ts +6 -5
- package/src/lib/promise/promise.type.d.ts +3 -3
- package/src/lib/promise/use.d.ts +3 -3
- package/src/lib/relation/relation.d.ts +15 -15
- package/src/lib/service/handler.config.d.ts +20 -16
- package/src/lib/service/handler.d.ts +3 -2
- package/src/lib/service/typed.service.d.ts +2 -2
- package/src/lib/set/set.d.ts +62 -59
- package/src/lib/set/set.delta.d.ts +5 -4
- package/src/lib/set/set.hashset.d.ts +5 -5
- package/src/lib/set/set.selection.d.ts +5 -4
- package/src/lib/sort.d.ts +11 -11
- package/src/lib/storage/storage.d.ts +2 -1
- package/src/lib/storage/storage.error.d.ts +4 -4
- package/src/lib/storage/storage.memory.d.ts +7 -7
- package/src/lib/storage/storage.object.d.ts +5 -5
- package/src/lib/string/case.d.ts +6 -6
- package/src/lib/string/char.d.ts +30 -29
- package/src/lib/string/dencoder.d.ts +25 -20
- package/src/lib/string/factory.d.ts +11 -8
- package/src/lib/string/html.d.ts +19 -19
- package/src/lib/string/mimetype.d.ts +9 -8
- package/src/lib/string/prefix.d.ts +8 -8
- package/src/lib/string/replace.d.ts +45 -39
- package/src/lib/string/search.d.ts +5 -4
- package/src/lib/string/sort.d.ts +13 -4
- package/src/lib/string/string.d.ts +44 -43
- package/src/lib/string/transform.d.ts +32 -23
- package/src/lib/string/tree.d.ts +5 -4
- package/src/lib/string/url.d.ts +5 -4
- package/src/lib/tree/tree.array.d.ts +5 -4
- package/src/lib/tree/tree.expand.d.ts +6 -6
- package/src/lib/tree/tree.explore.d.ts +13 -10
- package/src/lib/tree/tree.flatten.d.ts +10 -10
- package/src/lib/type.d.ts +42 -12
- package/src/lib/value/address.d.ts +7 -7
- package/src/lib/value/bound.d.ts +70 -66
- package/src/lib/value/build.d.ts +6 -6
- package/src/lib/value/comparator.d.ts +19 -17
- package/src/lib/value/cron.d.ts +2 -2
- package/src/lib/value/decision.d.ts +6 -5
- package/src/lib/value/equal.d.ts +11 -9
- package/src/lib/value/indexed.d.ts +101 -85
- package/src/lib/value/label.d.ts +2 -2
- package/src/lib/value/map.d.ts +20 -16
- package/src/lib/value/maybe.d.ts +36 -36
- package/src/lib/value/modifier.d.ts +24 -23
- package/src/lib/value/point.d.ts +85 -77
- package/src/lib/value/url.d.ts +2 -2
- package/src/lib/value/use.d.ts +36 -33
- package/src/lib/value/vector.d.ts +15 -14
- package/test/index.cjs.js +41 -36
- package/test/index.esm.js +41 -36
- package/test/package.json +2 -2
- package/test/src/lib/jest/jest.fail.d.ts +2 -2
- package/test/src/lib/shared/shared.d.ts +20 -20
- package/test/src/lib/shared/shared.fail.d.ts +21 -16
- package/test/src/lib/shared/shared.function.d.ts +4 -4
- package/test/src/lib/shared/shared.wrap.d.ts +10 -10
package/src/lib/string/char.d.ts
CHANGED
|
@@ -20,18 +20,18 @@ export interface FirstAndLastCharacterOccurrence {
|
|
|
20
20
|
/**
|
|
21
21
|
* Finds the first and last occurrence of a single character within the input string.
|
|
22
22
|
*
|
|
23
|
-
* @param input -
|
|
24
|
-
* @param find -
|
|
25
|
-
* @returns
|
|
26
|
-
* @throws Error
|
|
23
|
+
* @param input - String to search through.
|
|
24
|
+
* @param find - Single character to find.
|
|
25
|
+
* @returns An object containing the first index, last index, and total occurrence count.
|
|
26
|
+
* @throws {Error} If find is not exactly one character long.
|
|
27
27
|
*/
|
|
28
28
|
export declare function firstAndLastCharacterOccurrence(input: string, find: string): FirstAndLastCharacterOccurrence;
|
|
29
29
|
/**
|
|
30
30
|
* Checks whether the input string contains the given substring.
|
|
31
31
|
*
|
|
32
|
-
* @param input -
|
|
33
|
-
* @param find -
|
|
34
|
-
* @returns
|
|
32
|
+
* @param input - String to search within.
|
|
33
|
+
* @param find - Substring to search for.
|
|
34
|
+
* @returns True if the substring is found within the input.
|
|
35
35
|
*/
|
|
36
36
|
export declare function stringContains(input: string, find: string): boolean;
|
|
37
37
|
/**
|
|
@@ -42,53 +42,54 @@ export type ReplaceLastCharacterIfIsFunction = (input: string) => string;
|
|
|
42
42
|
* Creates a function that replaces the last character of a string with the replacement string
|
|
43
43
|
* if that character matches any of the specified values.
|
|
44
44
|
*
|
|
45
|
+
* @param replacement - String to substitute for the last character.
|
|
46
|
+
* @param is - Character(s) that trigger the replacement.
|
|
47
|
+
* @returns Conditionally replaces the last character.
|
|
48
|
+
*
|
|
45
49
|
* @dbxUtil
|
|
46
50
|
* @dbxUtilCategory string
|
|
47
51
|
* @dbxUtilKind factory
|
|
48
52
|
* @dbxUtilTags string, replace, last, character, conditional, factory
|
|
49
53
|
* @dbxUtilRelated replace-last-character-if, replace-character-at-index-if
|
|
50
54
|
*
|
|
51
|
-
* @param replacement - string to substitute for the last character
|
|
52
|
-
* @param is - character(s) that trigger the replacement
|
|
53
|
-
* @returns a function that conditionally replaces the last character
|
|
54
55
|
* @__NO_SIDE_EFFECTS__
|
|
55
56
|
*/
|
|
56
57
|
export declare function replaceLastCharacterIfIsFunction(replacement: string, is: ArrayOrValue<string>): ReplaceLastCharacterIfIsFunction;
|
|
57
58
|
/**
|
|
58
59
|
* Replaces the last character of a string with the replacement if the decision function returns true for that character.
|
|
59
60
|
*
|
|
60
|
-
* @param input -
|
|
61
|
-
* @param replacement -
|
|
62
|
-
* @param decision -
|
|
63
|
-
* @returns
|
|
61
|
+
* @param input - String to potentially modify.
|
|
62
|
+
* @param replacement - String to substitute for the last character.
|
|
63
|
+
* @param decision - Function that determines whether the last character should be replaced.
|
|
64
|
+
* @returns The modified string, or the original if the decision is false or the string is empty.
|
|
64
65
|
*/
|
|
65
66
|
export declare function replaceLastCharacterIf(input: string, replacement: string, decision: DecisionFunction<string>): string;
|
|
66
67
|
/**
|
|
67
68
|
* Replaces the character at the given index with the replacement string if the decision function returns true for that character.
|
|
68
69
|
*
|
|
69
|
-
* @param input -
|
|
70
|
-
* @param index -
|
|
71
|
-
* @param replacement -
|
|
72
|
-
* @param decision -
|
|
73
|
-
* @returns
|
|
70
|
+
* @param input - String to potentially modify.
|
|
71
|
+
* @param index - Character index to evaluate.
|
|
72
|
+
* @param replacement - String to substitute at the index.
|
|
73
|
+
* @param decision - Function that determines whether the character should be replaced.
|
|
74
|
+
* @returns The modified string, or the original if the decision is false.
|
|
74
75
|
*/
|
|
75
76
|
export declare function replaceCharacterAtIndexIf(input: string, index: number, replacement: string, decision: DecisionFunction<string>): string;
|
|
76
77
|
/**
|
|
77
78
|
* Replaces the character at the given index with the replacement string.
|
|
78
79
|
*
|
|
79
|
-
* @param input -
|
|
80
|
-
* @param index -
|
|
81
|
-
* @param replacement -
|
|
82
|
-
* @returns
|
|
80
|
+
* @param input - String to modify.
|
|
81
|
+
* @param index - Character index to replace.
|
|
82
|
+
* @param replacement - String to substitute at the index.
|
|
83
|
+
* @returns The string with the character at the index replaced.
|
|
83
84
|
*/
|
|
84
85
|
export declare function replaceCharacterAtIndexWith(input: string, index: number, replacement: string): string;
|
|
85
86
|
/**
|
|
86
87
|
* Splits the input string into two parts at the given character index.
|
|
87
88
|
*
|
|
88
|
-
* @param input -
|
|
89
|
-
* @param index -
|
|
90
|
-
* @param inclusive -
|
|
91
|
-
* @returns
|
|
89
|
+
* @param input - String to split.
|
|
90
|
+
* @param index - Character index at which to split.
|
|
91
|
+
* @param inclusive - If true, the character at the index is included in the tail; if false (default), it is excluded from both parts.
|
|
92
|
+
* @returns A tuple of [head, tail] substrings.
|
|
92
93
|
*/
|
|
93
94
|
export declare function splitStringAtIndex(input: string, index: number, inclusive?: boolean): [string, string];
|
|
94
95
|
/**
|
|
@@ -109,7 +110,7 @@ export declare const UTF_PRIVATE_USAGE_AREA_START = "\uF8FF";
|
|
|
109
110
|
* Creates a lookup record mapping each character in the input string to its index position.
|
|
110
111
|
* In case of duplicate characters, the last occurrence's index is used.
|
|
111
112
|
*
|
|
112
|
-
* @param chars -
|
|
113
|
-
* @returns
|
|
113
|
+
* @param chars - String whose characters become keys in the record.
|
|
114
|
+
* @returns A record mapping each character to its index in the input string.
|
|
114
115
|
*/
|
|
115
116
|
export declare function stringCharactersToIndexRecord(chars: string): Record<string, number>;
|
|
@@ -30,9 +30,9 @@ export type PrimativeKeyDencoderMap<D extends PrimativeKey, E extends PrimativeK
|
|
|
30
30
|
* Creates a bidirectional {@link PrimativeKeyDencoderMap} from the given values,
|
|
31
31
|
* allowing lookup in both directions (encoded-to-decoded and decoded-to-encoded).
|
|
32
32
|
*
|
|
33
|
-
* @param values -
|
|
34
|
-
* @returns
|
|
35
|
-
* @throws Error
|
|
33
|
+
* @param values - Encoder/decoder value pairs as tuples or a map object.
|
|
34
|
+
* @returns A bidirectional Map for encoding/decoding.
|
|
35
|
+
* @throws {Error} If any key or value is repeated.
|
|
36
36
|
*/
|
|
37
37
|
export declare function primativeKeyDencoderMap<D extends PrimativeKey, E extends PrimativeKey>(values: PrimativeKeyDencoderValues<D, E>): PrimativeKeyDencoderMap<D, E>;
|
|
38
38
|
/**
|
|
@@ -61,23 +61,24 @@ export type PrimativeKeyDencoderFunction<D extends PrimativeKey, E extends Prima
|
|
|
61
61
|
* Default fallback factory for {@link PrimativeKeyDencoderFunction} that always returns null,
|
|
62
62
|
* causing an error to be thrown for unknown values.
|
|
63
63
|
*
|
|
64
|
-
* @param _input -
|
|
65
|
-
* @returns
|
|
64
|
+
* @param _input - The unknown value to look up (ignored; always returns null)
|
|
65
|
+
* @returns Always returns null to signal an unknown value.
|
|
66
66
|
*/
|
|
67
67
|
export declare const PRIMATIVE_KEY_DENCODER_VALUE: (_input: unknown) => null;
|
|
68
68
|
/**
|
|
69
69
|
* Creates a new {@link PrimativeKeyDencoderFunction} that can bidirectionally encode/decode
|
|
70
70
|
* primitive key values based on the configured value pairs.
|
|
71
71
|
*
|
|
72
|
+
* @param config - Configuration with value pairs and optional default fallback.
|
|
73
|
+
* @returns Encodes or decodes single values or arrays.
|
|
74
|
+
* @throws {Error} If a single value lookup produces a null result and no default handles it.
|
|
75
|
+
*
|
|
72
76
|
* @dbxUtil
|
|
73
77
|
* @dbxUtilCategory string
|
|
74
78
|
* @dbxUtilKind factory
|
|
75
79
|
* @dbxUtilTags string, encode, decode, dencoder, bidirectional, factory, primitive
|
|
76
80
|
* @dbxUtilRelated primative-key-dencoder-map, primative-key-string-dencoder
|
|
77
81
|
*
|
|
78
|
-
* @param config - configuration with value pairs and optional default fallback
|
|
79
|
-
* @returns a function that encodes or decodes single values or arrays
|
|
80
|
-
* @throws Error if a single value lookup produces a null result and no default handles it
|
|
81
82
|
* @__NO_SIDE_EFFECTS__
|
|
82
83
|
*/
|
|
83
84
|
export declare function primativeKeyDencoder<D extends PrimativeKey, E extends PrimativeKey>(config: PrimativeKeyDencoderConfig<D, E>): PrimativeKeyDencoderFunction<D, E>;
|
|
@@ -108,15 +109,16 @@ export type PrimativeKeyStringDencoderFunction<D extends PrimativeKey, E extends
|
|
|
108
109
|
* When no splitter is defined, all encoded values must be exactly one character long so the string
|
|
109
110
|
* can be split character-by-character.
|
|
110
111
|
*
|
|
112
|
+
* @param config - Configuration with dencoder and optional splitter.
|
|
113
|
+
* @returns A bidirectional function for string-to-array and array-to-string conversion.
|
|
114
|
+
* @throws {Error} If encoded values contain the splitter character, or if values exceed one character when no splitter is defined.
|
|
115
|
+
*
|
|
111
116
|
* @dbxUtil
|
|
112
117
|
* @dbxUtilCategory string
|
|
113
118
|
* @dbxUtilKind factory
|
|
114
119
|
* @dbxUtilTags string, encode, decode, dencoder, splitter, factory, primitive
|
|
115
120
|
* @dbxUtilRelated primative-key-dencoder, primative-key-dencoder-map
|
|
116
121
|
*
|
|
117
|
-
* @param config - configuration with dencoder and optional splitter
|
|
118
|
-
* @returns a bidirectional function for string-to-array and array-to-string conversion
|
|
119
|
-
* @throws Error if encoded values contain the splitter character, or if values exceed one character when no splitter is defined
|
|
120
122
|
* @__NO_SIDE_EFFECTS__
|
|
121
123
|
*/
|
|
122
124
|
export declare function primativeKeyStringDencoder<D extends PrimativeKey, E extends PrimativeKey>(config: PrimativeKeyStringDencoderConfig<D, E>): PrimativeKeyStringDencoderFunction<D, E>;
|
|
@@ -157,7 +159,7 @@ export declare const NUMBER_STRING_DENCODER_64_DIGITS: NumberStringDencoderDigit
|
|
|
157
159
|
/**
|
|
158
160
|
* The default negative prefix for negative numbers.
|
|
159
161
|
*/
|
|
160
|
-
export declare const
|
|
162
|
+
export declare const DEFAULT_NUMBER_STRING_DENCODER_64_NEGATIVE_PREFIX = "!";
|
|
161
163
|
/**
|
|
162
164
|
* The NumberString dencoder type
|
|
163
165
|
* - positive_integer: can only encode/decode positive integers
|
|
@@ -208,8 +210,8 @@ export interface NumberStringDencoderConfig {
|
|
|
208
210
|
*
|
|
209
211
|
* If the config does not include a negative prefix, negative numbers lose their sign during encoding.
|
|
210
212
|
*
|
|
211
|
-
* @param config -
|
|
212
|
-
* @returns
|
|
213
|
+
* @param config - Configuration with digit alphabet and optional negative prefix.
|
|
214
|
+
* @returns A NumberStringDencoder capable of encoding/decoding integers.
|
|
213
215
|
*/
|
|
214
216
|
export declare function numberStringDencoder(config: NumberStringDencoderConfig): NumberStringDencoder;
|
|
215
217
|
/**
|
|
@@ -225,14 +227,15 @@ export type NumberStringDencoderFunction = ((input: NumberStringDencoderString)
|
|
|
225
227
|
* Creates a {@link NumberStringDencoderFunction} from the given dencoder.
|
|
226
228
|
* The returned function auto-detects the input type: numbers are encoded, strings are decoded.
|
|
227
229
|
*
|
|
230
|
+
* @param dencoder - The NumberStringDencoder to wrap.
|
|
231
|
+
* @returns A bidirectional encode/decode function.
|
|
232
|
+
*
|
|
228
233
|
* @dbxUtil
|
|
229
234
|
* @dbxUtilCategory string
|
|
230
235
|
* @dbxUtilKind factory
|
|
231
236
|
* @dbxUtilTags string, number, encode, decode, dencoder, bidirectional, factory
|
|
232
237
|
* @dbxUtilRelated number-string-dencoder, number-string-dencoder-encoded-string-value-function, number-string-dencoder-decoded-number-value-function
|
|
233
238
|
*
|
|
234
|
-
* @param dencoder - the NumberStringDencoder to wrap
|
|
235
|
-
* @returns a bidirectional encode/decode function
|
|
236
239
|
* @__NO_SIDE_EFFECTS__
|
|
237
240
|
*/
|
|
238
241
|
export declare function numberStringDencoderFunction(dencoder: NumberStringDencoder): NumberStringDencoderFunction;
|
|
@@ -240,14 +243,15 @@ export declare function numberStringDencoderFunction(dencoder: NumberStringDenco
|
|
|
240
243
|
* Creates a function that always returns the encoded string form of the input.
|
|
241
244
|
* Numbers are encoded; strings are passed through as-is.
|
|
242
245
|
*
|
|
246
|
+
* @param dencoder - The NumberStringDencoder to use for encoding.
|
|
247
|
+
* @returns Normalizes input to an encoded string.
|
|
248
|
+
*
|
|
243
249
|
* @dbxUtil
|
|
244
250
|
* @dbxUtilCategory string
|
|
245
251
|
* @dbxUtilKind factory
|
|
246
252
|
* @dbxUtilTags string, number, encode, normalize, factory
|
|
247
253
|
* @dbxUtilRelated number-string-dencoder-function, number-string-dencoder-decoded-number-value-function
|
|
248
254
|
*
|
|
249
|
-
* @param dencoder - the NumberStringDencoder to use for encoding
|
|
250
|
-
* @returns a function that normalizes input to an encoded string
|
|
251
255
|
* @__NO_SIDE_EFFECTS__
|
|
252
256
|
*/
|
|
253
257
|
export declare function numberStringDencoderEncodedStringValueFunction(dencoder: NumberStringDencoder): (input: NumberStringDencoderString | NumberStringDencoderNumber) => NumberStringDencoderString;
|
|
@@ -255,14 +259,15 @@ export declare function numberStringDencoderEncodedStringValueFunction(dencoder:
|
|
|
255
259
|
* Creates a function that always returns the decoded number form of the input.
|
|
256
260
|
* Strings are decoded; numbers are passed through as-is.
|
|
257
261
|
*
|
|
262
|
+
* @param dencoder - The NumberStringDencoder to use for decoding.
|
|
263
|
+
* @returns Normalizes input to a decoded number.
|
|
264
|
+
*
|
|
258
265
|
* @dbxUtil
|
|
259
266
|
* @dbxUtilCategory string
|
|
260
267
|
* @dbxUtilKind factory
|
|
261
268
|
* @dbxUtilTags string, number, decode, normalize, factory
|
|
262
269
|
* @dbxUtilRelated number-string-dencoder-function, number-string-dencoder-encoded-string-value-function
|
|
263
270
|
*
|
|
264
|
-
* @param dencoder - the NumberStringDencoder to use for decoding
|
|
265
|
-
* @returns a function that normalizes input to a decoded number
|
|
266
271
|
* @__NO_SIDE_EFFECTS__
|
|
267
272
|
*/
|
|
268
273
|
export declare function numberStringDencoderDecodedNumberValueFunction(dencoder: NumberStringDencoder): (input: NumberStringDencoderString | NumberStringDencoderNumber) => NumberStringDencoderNumber;
|
|
@@ -6,21 +6,22 @@ import { type TransformStringFunctionConfig } from './transform';
|
|
|
6
6
|
*/
|
|
7
7
|
export type StringFactory<K extends string = string> = Factory<K>;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Converts a value of type T to a string.
|
|
10
10
|
*/
|
|
11
11
|
export type ToStringFunction<T, K extends string = string> = FactoryWithRequiredInput<K, T>;
|
|
12
12
|
/**
|
|
13
13
|
* Wraps an existing factory with a {@link ToStringFunction} to produce strings from the factory's output.
|
|
14
14
|
*
|
|
15
|
+
* @param factory - The original value factory.
|
|
16
|
+
* @param toStringFunction - Function to convert the factory's output to a string.
|
|
17
|
+
* @returns A new factory that produces string values.
|
|
18
|
+
*
|
|
15
19
|
* @dbxUtil
|
|
16
20
|
* @dbxUtilCategory string
|
|
17
21
|
* @dbxUtilKind factory
|
|
18
22
|
* @dbxUtilTags string, factory, wrap, transform, to-string
|
|
19
23
|
* @dbxUtilRelated string-from-date-factory, string-from-time-factory
|
|
20
24
|
*
|
|
21
|
-
* @param factory - the original value factory
|
|
22
|
-
* @param toStringFunction - function to convert the factory's output to a string
|
|
23
|
-
* @returns a new factory that produces string values
|
|
24
25
|
* @__NO_SIDE_EFFECTS__
|
|
25
26
|
*/
|
|
26
27
|
export declare function stringFactoryFromFactory<T, K extends string = string>(factory: Factory<T>, toStringFunction: ToStringFunction<T, K>): StringFactory<K>;
|
|
@@ -50,28 +51,30 @@ export interface StringFromDateConfig {
|
|
|
50
51
|
/**
|
|
51
52
|
* Creates a factory that returns a string based on the input date.
|
|
52
53
|
*
|
|
54
|
+
* @param config - Configuration for the factory.
|
|
55
|
+
* @returns A factory that returns a string based on the input date.
|
|
56
|
+
*
|
|
53
57
|
* @dbxUtil
|
|
54
58
|
* @dbxUtilCategory string
|
|
55
59
|
* @dbxUtilKind factory
|
|
56
60
|
* @dbxUtilTags string, date, factory, transform, slice
|
|
57
61
|
* @dbxUtilRelated string-from-time-factory, string-factory-from-factory, transform-string-function
|
|
58
62
|
*
|
|
59
|
-
* @param config Configuration for the factory.
|
|
60
|
-
* @returns A factory that returns a string based on the input date.
|
|
61
63
|
* @__NO_SIDE_EFFECTS__
|
|
62
64
|
*/
|
|
63
65
|
export declare function stringFromDateFactory(config: StringFromDateConfig): StringFromDateFactory;
|
|
64
66
|
/**
|
|
65
67
|
* Creates a factory that returns a string based on the Unix timestamp of the input date.
|
|
66
68
|
*
|
|
69
|
+
* @param digitsFromEnd - The number of digits to return from the end of the generated string. Defaults to 7.
|
|
70
|
+
* @returns A StringFromDateFactory.
|
|
71
|
+
*
|
|
67
72
|
* @dbxUtil
|
|
68
73
|
* @dbxUtilCategory string
|
|
69
74
|
* @dbxUtilKind factory
|
|
70
75
|
* @dbxUtilTags string, date, time, timestamp, factory, suffix
|
|
71
76
|
* @dbxUtilRelated string-from-date-factory
|
|
72
77
|
*
|
|
73
|
-
* @param digitsFromEnd The number of digits to return from the end of the generated string. Defaults to 7.
|
|
74
|
-
* @returns A StringFromDateFactory.
|
|
75
78
|
* @__NO_SIDE_EFFECTS__
|
|
76
79
|
*/
|
|
77
80
|
export declare function stringFromTimeFactory(digitsFromEnd?: number): StringFromDateFactory;
|
package/src/lib/string/html.d.ts
CHANGED
|
@@ -47,27 +47,15 @@ export type CssTokenVar<T extends CssToken = CssToken> = `var(${T})`;
|
|
|
47
47
|
/**
|
|
48
48
|
* Converts a CSS token into a var() string.
|
|
49
49
|
*
|
|
50
|
+
* @param cssToken - The CSS token to convert.
|
|
51
|
+
* @returns The var() string.
|
|
52
|
+
*
|
|
50
53
|
* @example
|
|
51
54
|
* ```ts
|
|
52
55
|
* cssTokenVar('--dbx-primary-color'); // 'var(--dbx-primary-color)'
|
|
53
56
|
* ```
|
|
54
|
-
*
|
|
55
|
-
* @param cssToken - the CSS token to convert
|
|
56
|
-
* @returns the var() string
|
|
57
57
|
*/
|
|
58
58
|
export declare function cssTokenVar<T extends CssToken>(cssToken: T): CssTokenVar<T>;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated Use {@link CssToken} instead.
|
|
61
|
-
*/
|
|
62
|
-
export type CssVariable = CssToken;
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated Use {@link CssTokenVar} instead.
|
|
65
|
-
*/
|
|
66
|
-
export type CssVariableVar<T extends CssToken = CssToken> = CssTokenVar<T>;
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated Use {@link cssTokenVar} instead.
|
|
69
|
-
*/
|
|
70
|
-
export declare const cssVariableVar: typeof cssTokenVar;
|
|
71
59
|
/**
|
|
72
60
|
* Represents a single CSS Style
|
|
73
61
|
*
|
|
@@ -103,15 +91,27 @@ export type CssClassesArray = ArrayOrValue<ArrayOrValue<SpaceSeparatedCssClasses
|
|
|
103
91
|
/**
|
|
104
92
|
* Joins together various arrays of CSS classes into a single space-separated string of unique class names.
|
|
105
93
|
*
|
|
106
|
-
* @param cssClasses -
|
|
107
|
-
* @returns
|
|
94
|
+
* @param cssClasses - One or more CSS class values or arrays of class values.
|
|
95
|
+
* @returns A space-separated string of unique CSS class names, or an empty string if input is null/undefined.
|
|
108
96
|
*/
|
|
109
97
|
export declare function spaceSeparatedCssClasses(cssClasses: Maybe<CssClassesArray>): SpaceSeparatedCssClasses;
|
|
110
98
|
/**
|
|
111
99
|
* Parses and deduplicates CSS classes from various array/string inputs into a Set.
|
|
112
100
|
* Space-separated class strings are split into individual class names.
|
|
113
101
|
*
|
|
114
|
-
* @param cssClasses -
|
|
115
|
-
* @returns
|
|
102
|
+
* @param cssClasses - One or more CSS class values or arrays of class values.
|
|
103
|
+
* @returns Set of unique CSS class names, or an empty Set if input is null/undefined.
|
|
116
104
|
*/
|
|
117
105
|
export declare function cssClassesSet(cssClasses: Maybe<CssClassesArray>): Set<CssClass>;
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated Use {@link CssToken} instead.
|
|
108
|
+
*/
|
|
109
|
+
export type CssVariable = CssToken;
|
|
110
|
+
/**
|
|
111
|
+
* @deprecated Use {@link CssTokenVar} instead.
|
|
112
|
+
*/
|
|
113
|
+
export type CssVariableVar<T extends CssToken = CssToken> = CssTokenVar<T>;
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated Use {@link cssTokenVar} instead.
|
|
116
|
+
*/
|
|
117
|
+
export declare const cssVariableVar: typeof cssTokenVar;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SlashPathTypedFileExtension } from '../path/path';
|
|
2
|
+
import { type SuggestedString } from '../type';
|
|
2
3
|
import { type Maybe } from '../value/maybe.type';
|
|
3
4
|
/**
|
|
4
5
|
* A simple mime type string with just the type/subtype and no parameters.
|
|
@@ -106,8 +107,8 @@ export declare function mimeTypeForImageFileExtension(extension: Maybe<ImageFile
|
|
|
106
107
|
/**
|
|
107
108
|
* Returns the image file extension for the given MIME type, or undefined if the MIME type is not a known image type.
|
|
108
109
|
*
|
|
109
|
-
* @param mimeType -
|
|
110
|
-
* @returns
|
|
110
|
+
* @param mimeType - The MIME type to look up.
|
|
111
|
+
* @returns The corresponding image file extension, or undefined if not recognized.
|
|
111
112
|
*/
|
|
112
113
|
export declare function imageFileExtensionForMimeType(mimeType: Maybe<MimeTypeWithoutParameters>): Maybe<ImageFileExtension>;
|
|
113
114
|
/**
|
|
@@ -174,7 +175,7 @@ export declare function mimeTypeForDocumentFileExtension(extension: Maybe<Docume
|
|
|
174
175
|
/**
|
|
175
176
|
* Returns the document file extension for the given mimetype, or undefined if the mimetype is not known/recognized.
|
|
176
177
|
*
|
|
177
|
-
* @param mimeType The mimetype to get the document file extension for.
|
|
178
|
+
* @param mimeType - The mimetype to get the document file extension for.
|
|
178
179
|
* @returns The document file extension for the given mimetype, or undefined if the mimetype is not known.
|
|
179
180
|
*/
|
|
180
181
|
export declare function documentFileExtensionForMimeType(mimeType: Maybe<MimeTypeWithoutParameters>): Maybe<DocumentFileExtension>;
|
|
@@ -206,8 +207,8 @@ export declare function mimeTypeForApplicationFileExtension(extension: Maybe<App
|
|
|
206
207
|
/**
|
|
207
208
|
* Returns the application file extension for the given MIME type, or undefined if the MIME type is not a known application type.
|
|
208
209
|
*
|
|
209
|
-
* @param mimeType -
|
|
210
|
-
* @returns
|
|
210
|
+
* @param mimeType - The MIME type to look up.
|
|
211
|
+
* @returns The corresponding application file extension, or undefined if not recognized.
|
|
211
212
|
*/
|
|
212
213
|
export declare function applicationFileExtensionForMimeType(mimeType: Maybe<MimeTypeWithoutParameters>): Maybe<ApplicationFileExtension>;
|
|
213
214
|
/**
|
|
@@ -228,8 +229,8 @@ export declare function mimeTypeForFileExtension(extension: Maybe<DbxComponentsK
|
|
|
228
229
|
/**
|
|
229
230
|
* Returns the file extension for the given MIME type by checking image, document, and application types in order.
|
|
230
231
|
*
|
|
231
|
-
* @param mimeType -
|
|
232
|
-
* @returns
|
|
232
|
+
* @param mimeType - The MIME type to look up.
|
|
233
|
+
* @returns The corresponding file extension, or undefined if the MIME type is not recognized.
|
|
233
234
|
*/
|
|
234
235
|
export declare function fileExtensionForMimeType(mimeType: Maybe<MimeTypeWithoutParameters>): Maybe<DbxComponentsKnownFileExtension>;
|
|
235
236
|
/**
|
|
@@ -237,4 +238,4 @@ export declare function fileExtensionForMimeType(mimeType: Maybe<MimeTypeWithout
|
|
|
237
238
|
*
|
|
238
239
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Disposition
|
|
239
240
|
*/
|
|
240
|
-
export type ContentDispositionString = 'inline' | 'attachment'
|
|
241
|
+
export type ContentDispositionString = SuggestedString<'inline' | 'attachment'>;
|
|
@@ -20,7 +20,7 @@ export type CharacterPrefix = string;
|
|
|
20
20
|
*/
|
|
21
21
|
export type CharacterSuffix = string;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Does not have a CharacterPrefix or CharacterSuffix.
|
|
24
24
|
*
|
|
25
25
|
* @semanticType
|
|
26
26
|
* @semanticTopic string
|
|
@@ -28,15 +28,15 @@ export type CharacterSuffix = string;
|
|
|
28
28
|
*/
|
|
29
29
|
export type CharacterPrefixSuffixCleanString = string;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Is a combination of a prefix and suffix.
|
|
32
32
|
*/
|
|
33
33
|
export type CharacterPrefixSuffixString<P extends CharacterPrefix = '', S extends CharacterSuffix = '', T extends string = string> = `${P}${T}${S}`;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Has a known prefix.
|
|
36
36
|
*/
|
|
37
37
|
export type CharacterPrefixString<P extends CharacterPrefix = '', T extends string = string> = CharacterPrefixSuffixString<P, '', T>;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Has a known suffix.
|
|
40
40
|
*/
|
|
41
41
|
export type CharacterSuffixString<S extends CharacterSuffix = '', T extends string = string> = CharacterPrefixSuffixString<'', S, T>;
|
|
42
42
|
/**
|
|
@@ -103,8 +103,8 @@ export declare function characterPrefixSuffixInstance<P extends CharacterPrefix
|
|
|
103
103
|
* (vs. {@link removeFirstMatchingSuffix}, which silently passes the
|
|
104
104
|
* input through).
|
|
105
105
|
*
|
|
106
|
-
* @param input The string to trim.
|
|
107
|
-
* @param suffix The suffix to remove.
|
|
106
|
+
* @param input - The string to trim.
|
|
107
|
+
* @param suffix - The suffix to remove.
|
|
108
108
|
* @returns The input without the suffix, or `undefined` when the input
|
|
109
109
|
* does not end with the suffix.
|
|
110
110
|
*/
|
|
@@ -113,8 +113,8 @@ export declare function removeSuffix(input: string, suffix: string): Maybe<strin
|
|
|
113
113
|
* Removes the first matching suffix from the input string. Returns the
|
|
114
114
|
* input unchanged when none of the suffixes match.
|
|
115
115
|
*
|
|
116
|
-
* @param input The string to trim.
|
|
117
|
-
* @param suffixes The suffixes to try in order.
|
|
116
|
+
* @param input - The string to trim.
|
|
117
|
+
* @param suffixes - The suffixes to try in order.
|
|
118
118
|
* @returns The input with the first matching suffix removed, or the
|
|
119
119
|
* input unchanged when no suffix matches.
|
|
120
120
|
*/
|