@dereekb/util 13.3.1 → 13.4.1

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.
Files changed (82) hide show
  1. package/fetch/index.cjs.js +191 -109
  2. package/fetch/index.esm.js +191 -109
  3. package/fetch/package.json +2 -2
  4. package/fetch/src/lib/error.d.ts +6 -0
  5. package/fetch/src/lib/fetch.d.ts +37 -0
  6. package/fetch/src/lib/fetch.file.d.ts +7 -5
  7. package/fetch/src/lib/fetch.limit.d.ts +7 -0
  8. package/fetch/src/lib/fetch.url.d.ts +6 -3
  9. package/fetch/src/lib/json.d.ts +12 -1
  10. package/fetch/src/lib/timeout.d.ts +8 -0
  11. package/fetch/src/lib/url.d.ts +33 -0
  12. package/index.cjs.js +1561 -787
  13. package/index.esm.js +1560 -788
  14. package/package.json +1 -1
  15. package/src/lib/array/array.boolean.d.ts +7 -0
  16. package/src/lib/array/array.filter.d.ts +4 -4
  17. package/src/lib/array/array.index.d.ts +3 -1
  18. package/src/lib/array/array.indexed.d.ts +9 -3
  19. package/src/lib/array/array.limit.d.ts +2 -0
  20. package/src/lib/assertion/assert.d.ts +3 -0
  21. package/src/lib/assertion/assert.error.d.ts +6 -0
  22. package/src/lib/boolean.d.ts +3 -0
  23. package/src/lib/date/expires.d.ts +3 -3
  24. package/src/lib/date/minute.d.ts +14 -8
  25. package/src/lib/date/time.d.ts +3 -0
  26. package/src/lib/error/error.server.d.ts +1 -0
  27. package/src/lib/file/pdf.d.ts +1 -1
  28. package/src/lib/getter/getter.cache.d.ts +1 -1
  29. package/src/lib/grouping.d.ts +11 -2
  30. package/src/lib/map/map.key.d.ts +1 -1
  31. package/src/lib/model/model.d.ts +14 -9
  32. package/src/lib/number/dollar.d.ts +8 -0
  33. package/src/lib/number/number.d.ts +4 -0
  34. package/src/lib/object/index.d.ts +1 -0
  35. package/src/lib/object/object.equal.d.ts +2 -2
  36. package/src/lib/object/object.filter.pojo.d.ts +7 -0
  37. package/src/lib/object/object.filter.tuple.d.ts +2 -0
  38. package/src/lib/object/object.flatten.d.ts +43 -0
  39. package/src/lib/object/object.map.d.ts +1 -1
  40. package/src/lib/path/path.d.ts +4 -2
  41. package/src/lib/promise/poll.d.ts +3 -0
  42. package/src/lib/promise/promise.d.ts +19 -7
  43. package/src/lib/promise/promise.loop.d.ts +27 -9
  44. package/src/lib/relation/relation.d.ts +12 -0
  45. package/src/lib/service/handler.config.d.ts +3 -1
  46. package/src/lib/service/handler.d.ts +6 -2
  47. package/src/lib/service/typed.service.d.ts +3 -1
  48. package/src/lib/set/set.d.ts +32 -19
  49. package/src/lib/set/set.hashset.d.ts +3 -1
  50. package/src/lib/sort.d.ts +11 -0
  51. package/src/lib/storage/storage.error.d.ts +3 -0
  52. package/src/lib/storage/storage.memory.d.ts +7 -0
  53. package/src/lib/storage/storage.object.d.ts +5 -0
  54. package/src/lib/string/dencoder.d.ts +4 -1
  55. package/src/lib/string/mimetype.d.ts +57 -19
  56. package/src/lib/string/transform.d.ts +10 -1
  57. package/src/lib/string/tree.d.ts +18 -6
  58. package/src/lib/string/url.d.ts +57 -19
  59. package/src/lib/tree/tree.d.ts +12 -4
  60. package/src/lib/tree/tree.flatten.d.ts +3 -1
  61. package/src/lib/value/address.d.ts +24 -7
  62. package/src/lib/value/bound.d.ts +3 -0
  63. package/src/lib/value/build.d.ts +3 -0
  64. package/src/lib/value/comparator.d.ts +4 -0
  65. package/src/lib/value/cron.d.ts +1 -0
  66. package/src/lib/value/decision.d.ts +3 -0
  67. package/src/lib/value/equal.d.ts +3 -0
  68. package/src/lib/value/indexed.d.ts +4 -0
  69. package/src/lib/value/label.d.ts +1 -0
  70. package/src/lib/value/map.d.ts +9 -0
  71. package/src/lib/value/maybe.d.ts +13 -0
  72. package/src/lib/value/modifier.d.ts +9 -0
  73. package/src/lib/value/point.d.ts +3 -0
  74. package/src/lib/value/url.d.ts +1 -0
  75. package/src/lib/value/vector.d.ts +5 -0
  76. package/test/index.cjs.js +29 -6
  77. package/test/index.esm.js +29 -6
  78. package/test/package.json +2 -2
  79. package/test/src/lib/jest/jest.fail.d.ts +3 -3
  80. package/test/src/lib/shared/shared.d.ts +7 -1
  81. package/test/src/lib/shared/shared.fail.d.ts +8 -2
  82. package/test/src/lib/shared/shared.wrap.d.ts +1 -0
@@ -10,11 +10,17 @@ import { type Maybe } from '../value/maybe.type';
10
10
  * I.E. http, https, etc.
11
11
  */
12
12
  export type WebsiteProtocol = string;
13
- /** The HTTP protocol string literal type. */
13
+ /**
14
+ * The HTTP protocol string literal type.
15
+ */
14
16
  export type HttpWebsiteProtocol = 'http';
15
- /** The HTTPS protocol string literal type. */
17
+ /**
18
+ * The HTTPS protocol string literal type.
19
+ */
16
20
  export type HttpsWebsiteProtocol = 'https';
17
- /** Known HTTP protocols: `"http"` or `"https"`. */
21
+ /**
22
+ * Known HTTP protocols: `"http"` or `"https"`.
23
+ */
18
24
  export type KnownHttpWebsiteProtocol = HttpWebsiteProtocol | HttpsWebsiteProtocol;
19
25
  /**
20
26
  * Returns true if the input string is a known HTTP protocol (`"http"` or `"https"`).
@@ -147,27 +153,49 @@ export declare function isWebsiteUrl(input: string): input is WebsiteUrl;
147
153
  * Detailed analysis of whether an input string is a valid website URL, including its parsed components.
148
154
  */
149
155
  export interface WebsiteUrlDetails {
150
- /** The original input string. */
156
+ /**
157
+ * The original input string.
158
+ */
151
159
  readonly input: string;
152
- /** Whether the input is a valid website URL. */
160
+ /**
161
+ * Whether the input is a valid website URL.
162
+ */
153
163
  readonly isWebsiteUrl: boolean;
154
- /** Whether the input has an `http://` or `https://` prefix. */
164
+ /**
165
+ * Whether the input has an `http://` or `https://` prefix.
166
+ */
155
167
  readonly hasHttpPrefix: boolean;
156
- /** Whether the input contains a website domain. */
168
+ /**
169
+ * Whether the input contains a website domain.
170
+ */
157
171
  readonly hasWebsiteDomain: boolean;
158
- /** Whether the input contains a port number. */
172
+ /**
173
+ * Whether the input contains a port number.
174
+ */
159
175
  readonly hasPortNumber: boolean;
160
- /** The port number, or `undefined` if none is present. */
176
+ /**
177
+ * The port number, or `undefined` if none is present.
178
+ */
161
179
  readonly portNumber: PortNumber | undefined;
162
- /** The domain and path split pair. */
180
+ /**
181
+ * The domain and path split pair.
182
+ */
163
183
  readonly splitPair: WebsiteDomainAndPathPair;
164
- /** The extracted domain. */
184
+ /**
185
+ * The extracted domain.
186
+ */
165
187
  readonly domain: WebsiteDomain;
166
- /** The full website path including query string. */
188
+ /**
189
+ * The full website path including query string.
190
+ */
167
191
  readonly websitePath: WebsitePath;
168
- /** The path portion without query parameters. */
192
+ /**
193
+ * The path portion without query parameters.
194
+ */
169
195
  readonly path: string;
170
- /** The query string portion, or undefined if none. */
196
+ /**
197
+ * The query string portion, or undefined if none.
198
+ */
171
199
  readonly query: string | undefined;
172
200
  }
173
201
  /**
@@ -286,9 +314,13 @@ export declare function isolateWebsitePathFunction(config?: IsolateWebsitePathFu
286
314
  * A pair containing the path and optional query string components of a website URL.
287
315
  */
288
316
  export interface WebsitePathAndQueryPair {
289
- /** The path portion of the URL (before the `?`). */
317
+ /**
318
+ * The path portion of the URL (before the `?`).
319
+ */
290
320
  path: WebsitePath;
291
- /** The query string portion of the URL (including the leading `?`), if present. */
321
+ /**
322
+ * The query string portion of the URL (including the leading `?`), if present.
323
+ */
292
324
  query?: Maybe<WebsiteQueryString>;
293
325
  }
294
326
  /**
@@ -333,9 +365,13 @@ export declare function websitePathFromWebsiteDomainAndPath(input: WebsiteDomain
333
365
  * A pair containing the domain and path components of a website URL.
334
366
  */
335
367
  export interface WebsiteDomainAndPathPair {
336
- /** The domain portion of the URL. */
368
+ /**
369
+ * The domain portion of the URL.
370
+ */
337
371
  domain: WebsiteDomain;
338
- /** The path portion of the URL. */
372
+ /**
373
+ * The path portion of the URL.
374
+ */
339
375
  path: WebsitePath;
340
376
  }
341
377
  /**
@@ -402,7 +438,9 @@ export declare function hasHttpPrefix(input: string): input is BaseWebsiteUrl;
402
438
  * Object representation of a `mailto:` URL.
403
439
  */
404
440
  export interface MailToUrl {
405
- /** The email address for the mailto link. */
441
+ /**
442
+ * The email address for the mailto link.
443
+ */
406
444
  email: string;
407
445
  }
408
446
  /**
@@ -7,13 +7,21 @@
7
7
  * which is suitable for basic trees but can be overridden for custom node types.
8
8
  */
9
9
  export interface TreeNode<T, N extends TreeNode<T, N> = TreeNode<T, any>> {
10
- /** The depth of the node in the tree. The root node has a depth of 0. */
10
+ /**
11
+ * The depth of the node in the tree. The root node has a depth of 0.
12
+ */
11
13
  depth: number;
12
- /** The value associated with this tree node. */
14
+ /**
15
+ * The value associated with this tree node.
16
+ */
13
17
  value: T;
14
- /** A reference to the parent node, or undefined if this is the root node. */
18
+ /**
19
+ * A reference to the parent node, or undefined if this is the root node.
20
+ */
15
21
  parent?: N;
16
- /** An array of child nodes, or undefined if this node has no children. */
22
+ /**
23
+ * An array of child nodes, or undefined if this node has no children.
24
+ */
17
25
  children?: N[];
18
26
  }
19
27
  /**
@@ -104,6 +104,7 @@ export declare function flattenTreeToArrayFunction<N extends TreeNode<unknown>>(
104
104
  * Creates a FlattenTreeFunction that flattens tree nodes themselves into an array.
105
105
  *
106
106
  * @template N The type of the tree node.
107
+ * @param config - configuration object with optional mapping and node filtering settings
107
108
  * @returns A FlattenTreeFunction that collects nodes of type N.
108
109
  */
109
110
  export declare function flattenTreeToArrayFunction<N extends TreeNode<unknown, N>, V>(config: FlattenTreeToArrayFunctionConfig<N, V>): FlattenTreeFunction<N, V>;
@@ -112,7 +113,8 @@ export declare function flattenTreeToArrayFunction<N extends TreeNode<unknown, N
112
113
  *
113
114
  * @template N The type of the tree node.
114
115
  * @template V The type of the value to map each node to.
115
- * @param mapNodeFn An optional function to transform each node N into a value V. If not provided, nodes are returned as is.
116
+ * @param mapNodeFn - optional function to transform each node N into a value V; if not provided, nodes are returned as-is
117
+ * @param defaultAddNodeFn - optional decision function that filters which nodes are included in the result
116
118
  * @returns A FlattenTreeFunction that collects values of type V.
117
119
  */
118
120
  export declare function flattenTreeToArrayFunction<N extends TreeNode<unknown, N>, V>(mapNodeFn?: (node: N) => V, defaultAddNodeFn?: Maybe<FlattenTreeAddNodeDecisionFunction<N, V>>): FlattenTreeFunction<N, V>;
@@ -31,15 +31,25 @@ export type ZipCodeString = string;
31
31
  * Basic US address with two address lines, city, state, and zip code.
32
32
  */
33
33
  export interface UnitedStatesAddress {
34
- /** Primary street address line. */
34
+ /**
35
+ * Primary street address line.
36
+ */
35
37
  line1: AddressLineString;
36
- /** Secondary address line (apartment, suite, etc.). */
38
+ /**
39
+ * Secondary address line (apartment, suite, etc.).
40
+ */
37
41
  line2?: AddressLineString;
38
- /** City name. */
42
+ /**
43
+ * City name.
44
+ */
39
45
  city: CityString;
40
- /** State name or two-letter state code. */
46
+ /**
47
+ * State name or two-letter state code.
48
+ */
41
49
  state: StateString | StateCodeString;
42
- /** Postal/zip code. */
50
+ /**
51
+ * Postal/zip code.
52
+ */
43
53
  zip: ZipCodeString;
44
54
  }
45
55
  /**
@@ -47,9 +57,13 @@ export interface UnitedStatesAddress {
47
57
  * such as a recipient name and phone number.
48
58
  */
49
59
  export interface UnitedStatesAddressWithContact extends UnitedStatesAddress {
50
- /** Contact name associated with this address. */
60
+ /**
61
+ * Contact name associated with this address.
62
+ */
51
63
  name?: string;
52
- /** Phone number associated with this address. */
64
+ /**
65
+ * Phone number associated with this address.
66
+ */
53
67
  phone?: string;
54
68
  }
55
69
  /**
@@ -60,6 +74,7 @@ export interface UnitedStatesAddressWithContact extends UnitedStatesAddress {
60
74
  *
61
75
  * @param input - the address to format
62
76
  * @param addLinebreaks - whether to join parts with newlines (default `true`) or concatenate them directly
77
+ * @returns the formatted address string, or `undefined` if no meaningful parts are present
63
78
  */
64
79
  export declare function unitedStatesAddressString(input: Maybe<Partial<UnitedStatesAddress | UnitedStatesAddressWithContact>>, addLinebreaks?: boolean): Maybe<string>;
65
80
  /**
@@ -68,6 +83,7 @@ export declare function unitedStatesAddressString(input: Maybe<Partial<UnitedSta
68
83
  * Useful for validating an address before submission or display.
69
84
  *
70
85
  * @param input - the address to validate
86
+ * @returns `true` if all required fields (line1, city, state, zip) are populated
71
87
  *
72
88
  * @example
73
89
  * ```ts
@@ -95,6 +111,7 @@ export declare const US_STATE_CODE_STRING_REGEX: RegExp;
95
111
  * Only matches uppercase codes; lowercase input returns `false`.
96
112
  *
97
113
  * @param input - the string to test
114
+ * @returns `true` if the input matches a valid US state or territory code
98
115
  *
99
116
  * @example
100
117
  * ```ts
@@ -26,6 +26,9 @@ export interface LatLngBound {
26
26
  export type LatLngBoundOrPoint = LatLngBound | LatLngPoint;
27
27
  /**
28
28
  * Type guard that checks whether the input is a {@link LatLngBound} by testing for the presence of `sw` and `ne` properties.
29
+ *
30
+ * @param input - value to test
31
+ * @returns `true` if the input has `sw` and `ne` properties, indicating a bound
29
32
  */
30
33
  export declare function isLatLngBound(input: LatLngBound | unknown): input is LatLngBound;
31
34
  /**
@@ -28,6 +28,9 @@ export interface BuildConfig<T extends object> {
28
28
  * This is useful when building objects whose type is normally read-only, allowing incremental property assignment during construction.
29
29
  *
30
30
  * @param config - the build configuration containing the base object and build function
31
+ * @param config.base - optional pre-existing partial object to build upon; defaults to an empty object
32
+ * @param config.build - function that mutates the base object to populate it with desired values
33
+ * @returns the fully constructed object of type T
31
34
  *
32
35
  * @example
33
36
  * ```ts
@@ -12,6 +12,7 @@ export type EqualityComparatorFunction<T> = (a: T, b: T) => boolean;
12
12
  * but `null === undefined` is `false`.
13
13
  *
14
14
  * @param compare - the comparator to wrap
15
+ * @returns a new comparator that handles nullish values safely before delegating to the wrapped comparator
15
16
  *
16
17
  * @example
17
18
  * ```ts
@@ -31,6 +32,7 @@ export declare function safeEqualityComparatorFunction<T>(compare: EqualityCompa
31
32
  * @param a - first value to compare
32
33
  * @param b - second value to compare
33
34
  * @param compare - the equality comparator for non-nullish values
35
+ * @returns `true` if the values are considered equal
34
36
  *
35
37
  * @example
36
38
  * ```ts
@@ -67,6 +69,7 @@ export type CompareEqualityWithValueFromItemsFunction<I, V> = ((a: Maybe<I>, b:
67
69
  *
68
70
  * @param readValues - extracts the comparable value from each item
69
71
  * @param equalityComparator - compares the extracted values for equality
72
+ * @returns a function that compares two items by their extracted values
70
73
  */
71
74
  export declare function compareEqualityWithValueFromItemsFunction<I, V>(readValues: ReadValueFunction<I, V>, equalityComparator: EqualityComparatorFunction<V>): CompareEqualityWithValueFromItemsFunction<I, V>;
72
75
  /**
@@ -80,6 +83,7 @@ export type CompareEqualityWithValueFromItemsFunctionFactory<I, V> = ((equalityC
80
83
  * with varying comparison strategies.
81
84
  *
82
85
  * @param readValues - extracts the comparable value from each item
86
+ * @returns a factory function that accepts an equality comparator and produces a comparison function
83
87
  *
84
88
  * @example
85
89
  * ```ts
@@ -11,6 +11,7 @@ export type CronExpression = string;
11
11
  * every 1 hour at minute 30), which means intervals won't be exactly N minutes apart.
12
12
  *
13
13
  * @param inputMinutes - interval in minutes between executions
14
+ * @returns a cron expression string that approximates the requested interval
14
15
  *
15
16
  * @example
16
17
  * ```ts
@@ -19,6 +19,7 @@ export type DecisionFunctionFactory<C, I> = FactoryWithRequiredInput<DecisionFun
19
19
  * Useful for providing a constant decision where a function is expected.
20
20
  *
21
21
  * @param decision - the constant boolean value to return
22
+ * @returns a decision function that always returns the given boolean
22
23
  *
23
24
  * @example
24
25
  * ```ts
@@ -50,6 +51,7 @@ export declare const invertDecision: <F extends DecisionFunction<any>>(fn: F, in
50
51
  *
51
52
  * @param valueOrFunction - a boolean, decision function, or undefined
52
53
  * @param defaultIfUndefined - fallback boolean when the input is nullish (defaults to true)
54
+ * @returns a {@link DecisionFunction} derived from the input
53
55
  *
54
56
  * @example
55
57
  * ```ts
@@ -68,6 +70,7 @@ export declare function asDecisionFunction<T = unknown>(valueOrFunction: Maybe<b
68
70
  * concrete value or a custom decision function interchangeably.
69
71
  *
70
72
  * @param equalityValue - the value to compare against, or an existing decision function
73
+ * @returns a decision function that checks strict equality with the given value
71
74
  *
72
75
  * @example
73
76
  * ```ts
@@ -16,6 +16,7 @@ export type AreEqualContext<T = unknown> = (x: IterableOrValue<T>) => boolean;
16
16
  *
17
17
  * @param contextValue - the reference value to compare against
18
18
  * @param fn - the equality comparator
19
+ * @returns a function that checks whether a given value equals the captured reference
19
20
  *
20
21
  * @example
21
22
  * ```ts
@@ -35,6 +36,7 @@ export declare function isEqualContext<T>(contextValue: T, fn: EqualityComparato
35
36
  *
36
37
  * @param contextValue - the reference value to compare against
37
38
  * @param fn - the equality comparator
39
+ * @returns a function that checks whether all input values equal the captured reference
38
40
  *
39
41
  * @example
40
42
  * ```ts
@@ -54,6 +56,7 @@ export declare function areEqualContext<T>(contextValue: T, fn: EqualityComparat
54
56
  *
55
57
  * @param values - the values to compare
56
58
  * @param fn - the equality comparator
59
+ * @returns `true` if all values are equal to each other, or if fewer than two values are provided
57
60
  *
58
61
  * @example
59
62
  * ```ts
@@ -363,11 +363,15 @@ export type IndexRefRangeCheckFunction<T> = (value: T) => boolean;
363
363
  * within the specified range. For IndexRef types, the index is read from `i` automatically.
364
364
  *
365
365
  * @param input - the range or range config to check against
366
+ * @returns a function that checks whether an item's index is within the range
366
367
  */
367
368
  export declare function indexRangeCheckReaderFunction<T extends IndexRef>(input: IndexRangeFunctionInput): IndexRefRangeCheckFunction<T>;
368
369
  /**
370
+ * Creates an {@link IndexRefRangeCheckFunction} that reads an item's index using a custom reader and checks whether it falls within the specified range.
371
+ *
369
372
  * @param input - the range or range config to check against
370
373
  * @param read - custom function to extract the index from the item
374
+ * @returns a function that checks whether an item's index is within the range
371
375
  */
372
376
  export declare function indexRangeCheckReaderFunction<T>(input: IndexRangeFunctionInput, read: ReadIndexFunction<T>): IndexRefRangeCheckFunction<T>;
373
377
  /**
@@ -17,6 +17,7 @@ export interface LabeledValue<T> extends LabelRef {
17
17
  * Enables fast lookup of labeled items by their value key.
18
18
  *
19
19
  * @param values - array of labeled values to index
20
+ * @returns a Map keyed by each item's value for fast lookup
20
21
  *
21
22
  * @example
22
23
  * ```ts
@@ -61,14 +61,22 @@ export declare function mapArrayFunction<I, O>(mapFunction: MapFunction<I, O>):
61
61
  *
62
62
  * Used as a sentinel value so that {@link chainMapSameFunctions} and other combinators can detect
63
63
  * and skip no-op mappings for efficiency.
64
+ *
65
+ * @param input - the value to pass through unchanged
66
+ * @returns the same input value, unmodified
64
67
  */
65
68
  export declare const MAP_IDENTITY: <T>(input: T) => T;
66
69
  /**
67
70
  * Returns the shared {@link MAP_IDENTITY} function cast to the requested type, useful for providing a typed no-op transformation.
71
+ *
72
+ * @returns the singleton identity function typed as `MapFunction<T, T>`
68
73
  */
69
74
  export declare function mapIdentityFunction<T>(): MapFunction<T, T>;
70
75
  /**
71
76
  * Checks whether the given function is the singleton {@link MAP_IDENTITY} reference.
77
+ *
78
+ * @param fn - the function to check
79
+ * @returns `true` if the function is the identity singleton
72
80
  */
73
81
  export declare function isMapIdentityFunction(fn: unknown): fn is typeof MAP_IDENTITY;
74
82
  /**
@@ -136,6 +144,7 @@ export declare function chainMapSameFunctions<I>(input: ArrayOrValue<Maybe<MapSa
136
144
  * @param a - the first map function
137
145
  * @param b - the optional second map function to chain after `a`
138
146
  * @param apply - when false, skips chaining and returns `a` directly
147
+ * @returns a composed function piping `a` into `b`, or `a` alone if `b` is absent or `apply` is false
139
148
  */
140
149
  export declare function chainMapFunction<I>(a: MapSameFunction<I>, b: Maybe<MapSameFunction<I>>): MapSameFunction<I>;
141
150
  export declare function chainMapFunction<I>(a: MapSameFunction<I>, b: Maybe<MapSameFunction<I>>, apply?: boolean): MapSameFunction<I>;
@@ -3,6 +3,7 @@ import { type Maybe, type MaybeNot, type MaybeSo } from './maybe.type';
3
3
  * Type guard that returns `true` if the value is not `null` or `undefined`.
4
4
  *
5
5
  * @param value - the value to check
6
+ * @returns `true` if the value is not `null` or `undefined`
6
7
  */
7
8
  export declare function hasNonNullValue<T = unknown>(value: Maybe<T>): value is MaybeSo<T>;
8
9
  /**
@@ -15,6 +16,7 @@ export declare function hasNonNullValue<T = unknown>(value: Maybe<T>): value is
15
16
  * NaN has undefined behavior.
16
17
  *
17
18
  * @param value - the value to check
19
+ * @returns `true` if the value is non-nullish and not empty
18
20
  */
19
21
  export declare function hasValueOrNotEmpty<T = unknown>(value: Maybe<T>): value is MaybeSo<T>;
20
22
  /**
@@ -26,12 +28,14 @@ export declare function hasValueOrNotEmpty<T = unknown>(value: Maybe<T>): value
26
28
  * NaN has undefined behavior.
27
29
  *
28
30
  * @param value - the value to check
31
+ * @returns `true` if the value is non-nullish, non-empty, and not an empty object
29
32
  */
30
33
  export declare function hasValueOrNotEmptyObject<T = unknown>(value: Maybe<T>): value is MaybeSo<T>;
31
34
  /**
32
35
  * Returns `true` if the input value is a non-empty string or is `true`.
33
36
  *
34
37
  * @param value - the value to check
38
+ * @returns `true` if the value is a non-empty string or is `true`
35
39
  */
36
40
  export declare function isStringOrTrue(value: Maybe<string | boolean>): boolean;
37
41
  /**
@@ -40,12 +44,14 @@ export declare function isStringOrTrue(value: Maybe<string | boolean>): boolean;
40
44
  * Useful for filtering out both nullish values and empty strings in a single check.
41
45
  *
42
46
  * @param value - the value to check
47
+ * @returns `true` if the value is not nullish and not an empty string
43
48
  */
44
49
  export declare function isNotNullOrEmptyString<T>(value: Maybe<MaybeNot | '' | T>): value is MaybeSo<T>;
45
50
  /**
46
51
  * Type guard that returns `true` if the input is `null` or `undefined`.
47
52
  *
48
53
  * @param value - the value to check
54
+ * @returns `true` if the value is `null` or `undefined`
49
55
  */
50
56
  export declare function isMaybeNot<T = unknown>(value: Maybe<T>): value is MaybeNot;
51
57
  /**
@@ -54,6 +60,7 @@ export declare function isMaybeNot<T = unknown>(value: Maybe<T>): value is Maybe
54
60
  * Equivalent to {@link hasNonNullValue} but with the `MaybeSo` narrowing type.
55
61
  *
56
62
  * @param value - the value to check
63
+ * @returns `true` if the value is neither `null` nor `undefined`
57
64
  */
58
65
  export declare function isMaybeSo<T>(value: Maybe<T>): value is MaybeSo<T>;
59
66
  /**
@@ -62,18 +69,21 @@ export declare function isMaybeSo<T>(value: Maybe<T>): value is MaybeSo<T>;
62
69
  * Useful for optional boolean flags where both absence and `true` indicate the same behavior.
63
70
  *
64
71
  * @param value - the value to check
72
+ * @returns `true` if the value is nullish or strictly `true`
65
73
  */
66
74
  export declare function isMaybeNotOrTrue<T = unknown>(value: Maybe<T | true>): value is MaybeNot | true;
67
75
  /**
68
76
  * Returns `true` if the input is not `null`, `undefined`, or `false`.
69
77
  *
70
78
  * @param value - the value to check
79
+ * @returns `true` if the value is not `null`, `undefined`, or `false`
71
80
  */
72
81
  export declare function isDefinedAndNotFalse<T = unknown>(value: Maybe<T>): boolean;
73
82
  /**
74
83
  * Returns `true` if the input is not strictly `false`. Nullish values return `true`.
75
84
  *
76
85
  * @param value - the value to check
86
+ * @returns `true` if the value is not strictly `false`
77
87
  */
78
88
  export declare function isNotFalse<T = unknown>(value: Maybe<T>): boolean;
79
89
  /**
@@ -81,6 +91,7 @@ export declare function isNotFalse<T = unknown>(value: Maybe<T>): boolean;
81
91
  *
82
92
  * @param a - first value
83
93
  * @param b - second value
94
+ * @returns `true` if both values are non-nullish and strictly equal
84
95
  */
85
96
  export declare function isSameNonNullValue<T>(a: Maybe<T>, b: Maybe<T>): a is NonNullable<T>;
86
97
  /**
@@ -90,6 +101,7 @@ export declare function isSameNonNullValue<T>(a: Maybe<T>, b: Maybe<T>): a is No
90
101
  *
91
102
  * @param a - first value
92
103
  * @param b - second value
104
+ * @returns `true` if both are nullish or both are the same value
93
105
  */
94
106
  export declare function valuesAreBothNullishOrEquivalent<T>(a: Maybe<T>, b: Maybe<T>): boolean;
95
107
  /**
@@ -101,5 +113,6 @@ export declare function valuesAreBothNullishOrEquivalent<T>(a: Maybe<T>, b: Mayb
101
113
  *
102
114
  * @param a - the current value
103
115
  * @param b - the update value
116
+ * @returns `a` if `b` is undefined, otherwise `b`
104
117
  */
105
118
  export declare function updateMaybeValue<T>(a: Maybe<T>, b: Maybe<T>): Maybe<T>;
@@ -30,6 +30,7 @@ export interface Modifier<T> extends ModifierFunctionRef<T> {
30
30
  *
31
31
  * @param key - unique identifier for the modifier
32
32
  * @param modify - function that mutates the target value
33
+ * @returns a new {@link Modifier} pairing the key with the modify function
33
34
  *
34
35
  * @example
35
36
  * ```ts
@@ -42,6 +43,8 @@ export interface Modifier<T> extends ModifierFunctionRef<T> {
42
43
  export declare function modifier<T>(key: string, modify: ModifierFunction<T>): Modifier<T>;
43
44
  /**
44
45
  * A no-operation modifier that does nothing to the input. Useful as a default/fallback.
46
+ *
47
+ * @returns undefined (no mutation is performed)
45
48
  */
46
49
  export declare const NOOP_MODIFIER: ModifierFunction<any>;
47
50
  /**
@@ -55,6 +58,7 @@ export type ModifierMap<T> = Map<ModifierKey, Modifier<T>>;
55
58
  *
56
59
  * @param modifiers - modifier(s) to add
57
60
  * @param map - existing map to add to, or undefined to create a new one
61
+ * @returns the modifier map with the new modifiers added
58
62
  *
59
63
  * @example
60
64
  * ```ts
@@ -69,6 +73,7 @@ export declare function addModifiers<T>(modifiers: ArrayOrValue<Modifier<T>>, ma
69
73
  *
70
74
  * @param modifiers - modifier(s) whose keys should be removed
71
75
  * @param map - the map to remove from
76
+ * @returns the modifier map with the specified modifiers removed
72
77
  *
73
78
  * @example
74
79
  * ```ts
@@ -85,6 +90,7 @@ export declare function removeModifiers<T>(modifiers: ArrayOrValue<Modifier<T>>,
85
90
  * Returns {@link NOOP_MODIFIER} if the map is nullish or empty.
86
91
  *
87
92
  * @param map - the modifier map to convert
93
+ * @returns a single modifier function that applies all mapped modifiers, or {@link NOOP_MODIFIER} if empty
88
94
  *
89
95
  * @example
90
96
  * ```ts
@@ -103,6 +109,7 @@ export declare function modifierMapToFunction<T>(map: Maybe<ModifierMap<T>>): Mo
103
109
  * Returns undefined if no map is provided, allowing callers to distinguish "no modifiers" from "empty modifiers".
104
110
  *
105
111
  * @param map - the modifier map to convert
112
+ * @returns a composed modifier function, or `undefined` if no map is provided
106
113
  */
107
114
  export declare function maybeModifierMapToFunction<T>(map: Maybe<ModifierMap<T>>): Maybe<ModifierFunction<T>>;
108
115
  /**
@@ -111,6 +118,7 @@ export declare function maybeModifierMapToFunction<T>(map: Maybe<ModifierMap<T>>
111
118
  * Returns {@link NOOP_MODIFIER} if the array is empty or nullish.
112
119
  *
113
120
  * @param modifiers - array of modifier functions to merge
121
+ * @returns a single modifier function that applies all provided modifiers, or {@link NOOP_MODIFIER} if empty
114
122
  *
115
123
  * @example
116
124
  * ```ts
@@ -129,5 +137,6 @@ export declare function mergeModifiers<T>(modifiers: ModifierFunction<T>[]): Mod
129
137
  * If only one modifier is provided, returns it directly without wrapping.
130
138
  *
131
139
  * @param modifiers - array of modifier functions to merge, or undefined
140
+ * @returns a composed modifier function, the single modifier if only one provided, or `undefined` if input is nullish
132
141
  */
133
142
  export declare function maybeMergeModifiers<T>(modifiers: Maybe<ModifierFunction<T>[]>): Maybe<ModifierFunction<T>>;
@@ -51,6 +51,9 @@ export interface LonLatPoint {
51
51
  }
52
52
  /**
53
53
  * Type guard that checks whether the input is a {@link LatLngPoint} by testing for `lat` and `lng` properties.
54
+ *
55
+ * @param input - the value to test
56
+ * @returns `true` if the input has both `lat` and `lng` properties
54
57
  */
55
58
  export declare function isLatLngPoint(input: LatLngPoint | unknown): input is LatLngPoint;
56
59
  /**
@@ -4,6 +4,7 @@
4
4
  * Operates via simple string splitting rather than URL parsing, so it works with partial or non-standard URLs.
5
5
  *
6
6
  * @param url - the full URL string to clean
7
+ * @returns the URL string with query parameters and hash fragments removed
7
8
  *
8
9
  * @example
9
10
  * ```ts
@@ -18,6 +18,7 @@ export type VectorTuple = [number, number];
18
18
  *
19
19
  * @param a - first vector
20
20
  * @param b - second vector
21
+ * @returns `true` if both vectors are equal or both are nullish
21
22
  */
22
23
  export declare function isSameVector(a: Maybe<Partial<Vector>>, b: Maybe<Partial<Vector>>): boolean;
23
24
  /**
@@ -25,6 +26,7 @@ export declare function isSameVector(a: Maybe<Partial<Vector>>, b: Maybe<Partial
25
26
  *
26
27
  * @param a - first vector
27
28
  * @param b - second vector
29
+ * @returns `true` if both vectors have identical `x` and `y` values
28
30
  */
29
31
  export declare function vectorsAreEqual(a: Partial<Vector>, b: Partial<Vector>): boolean;
30
32
  /**
@@ -38,6 +40,7 @@ export type VectorResizeFunction = (input: Vector) => Vector;
38
40
  * If a minimum is not specified for an axis, the input value is passed through unchanged.
39
41
  *
40
42
  * @param minSize - the minimum dimensions to enforce
43
+ * @returns a resize function that clamps each axis to the specified minimum
41
44
  *
42
45
  * @example
43
46
  * ```ts
@@ -79,6 +82,7 @@ export interface Rectangle {
79
82
  *
80
83
  * @param a - first rectangle
81
84
  * @param b - second rectangle
85
+ * @returns `true` if the rectangles share any interior area
82
86
  *
83
87
  * @example
84
88
  * ```ts
@@ -98,5 +102,6 @@ export declare function rectangleOverlapsRectangle(a: Rectangle, b: Rectangle):
98
102
  *
99
103
  * @param a - first rectangle
100
104
  * @param b - second rectangle
105
+ * @returns the overlapping {@link Rectangle}, or `undefined` if the rectangles do not intersect
101
106
  */
102
107
  export declare function getOverlappingRectangle(a: Rectangle, b: Rectangle): Maybe<Rectangle>;