@helpers4/all 2.0.0-alpha.17 → 2.0.0-alpha.19

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/llms.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  # @helpers4/all
2
2
 
3
3
  > Complete collection of tree-shakable TypeScript utility functions.
4
- > Version: 2.0.0-alpha.17 — License: LGPL-3.0-or-later
4
+ > Version: 2.0.0-alpha.19 — License: LGPL-3.0-or-later
5
5
 
6
6
  ## About
7
7
 
@@ -60,7 +60,6 @@ pnpm add @helpers4/version
60
60
  | `@helpers4/date` | `addYears` | Adds years to a date. Returns a **new** `Date` — the original is never mutated. Returns `null` if t |
61
61
  | `@helpers4/date` | `clampDate` | Clamps a date to a [min, max] range. Returns a **new** `Date` — the original is never mutated. Retu |
62
62
  | `@helpers4/date` | `compare` | Comparison of two dates. Accepts any DateLike input (Date, timestamp, or date string). |
63
- | `@helpers4/date` | `DateCompareOptions` | Options for date comparison |
64
63
  | `@helpers4/date` | `DateDifferenceOptions` | Options for date difference calculation |
65
64
  | `@helpers4/date` | `DateLike` | A value that can be converted to a Date. - `Date` — used as-is (validated for Invalid Date) - `numb |
66
65
  | `@helpers4/date` | `DateRange` | A date range represented as a pair of date-like values. |
@@ -76,7 +75,6 @@ pnpm add @helpers4/version
76
75
  | `@helpers4/date` | `ensureDate` | Safely converts a date-like value to a valid `Date` object, or returns `null`. Accepts `Date`, time |
77
76
  | `@helpers4/date` | `EpochMilliseconds` | An object that exposes an epoch timestamp in milliseconds. This structural type is satisfied by `Te |
78
77
  | `@helpers4/date` | `formatDuration` | Formats a duration in milliseconds as a compact human-readable string. Produces output like `"1h 23 |
79
- | `@helpers4/date` | `FormatDurationOptions` | Options for formatDuration. |
80
78
  | `@helpers4/date` | `formatInTimezone` | Formats a date in a specific IANA timezone using `Intl.DateTimeFormat`. Returns `null` if the date |
81
79
  | `@helpers4/date` | `FormatInTimezoneOptions` | Options for formatInTimezone. |
82
80
  | `@helpers4/date` | `fromMillis` | Creates a `Date` from a timestamp in **milliseconds**. Use this when receiving a timestamp from a J |
@@ -97,7 +95,6 @@ pnpm add @helpers4/version
97
95
  | `@helpers4/date` | `safeDate` | Safely creates a Date object from various input types. |
98
96
  | `@helpers4/date` | `startOf` | Returns a new `Date` set to the **start** of the given unit. - `'day'` — 00:00:00.000 - `'month'` |
99
97
  | `@helpers4/date` | `timeAgo` | Formats a date as a human-readable relative time string. Uses `Intl.RelativeTimeFormat` under the h |
100
- | `@helpers4/date` | `TimeAgoOptions` | Options for timeAgo. |
101
98
  | `@helpers4/date` | `toISO8601` | Converts a date to ISO 8601 format Format: YYYY-MM-DDTHH:mm:ss.sssZ |
102
99
  | `@helpers4/date` | `toMillis` | Converts a date to a timestamp in **milliseconds** (epoch millis). Use this when you need a plain n |
103
100
  | `@helpers4/date` | `toRFC2822` | Converts a date to RFC 2822 format Format: Day, DD Mon YYYY HH:mm:ss +0000 Used in email headers (Da |
@@ -113,6 +110,7 @@ pnpm add @helpers4/version
113
110
  | `@helpers4/function` | `throttle` | Creates a throttled function that only invokes func at most once per every wait milliseconds |
114
111
  | `@helpers4/math` | `uuid7` | Generates a UUID v7 string (RFC 9562). UUID v7 embeds a Unix timestamp in milliseconds, making it ch |
115
112
  | `@helpers4/number` | `clamp` | Clamps a number between min and max values |
113
+ | `@helpers4/number` | `formatSize` | Format a byte count into a human-readable string with the appropriate unit. Each unit is 1024 of th |
116
114
  | `@helpers4/number` | `randomBetween` | Generates a random number between min and max (inclusive) |
117
115
  | `@helpers4/number` | `randomIntBetween` | Generates a random integer between min and max (inclusive) |
118
116
  | `@helpers4/number` | `roundTo` | Rounds a number to specified decimal places |
@@ -120,7 +118,6 @@ pnpm add @helpers4/version
120
118
  | `@helpers4/object` | `compact` | Removes all entries with falsy values (`false`, `null`, `undefined`, `0`, `""`, `NaN`) from an objec |
121
119
  | `@helpers4/object` | `deepClone` | Creates a deep copy of an object or array |
122
120
  | `@helpers4/object` | `deepCompare` | Deep comparison of two objects that returns detailed information about differences. |
123
- | `@helpers4/object` | `DeepCompareResult` | Result type for deep comparison when objects are not identical |
124
121
  | `@helpers4/object` | `deepMerge` | Merges two or more objects deeply |
125
122
  | `@helpers4/object` | `get` | Gets a value from an object using a dot-notated path |
126
123
  | `@helpers4/object` | `omit` | Creates a new object without the specified keys. |
@@ -136,7 +133,6 @@ pnpm add @helpers4/version
136
133
  | `@helpers4/promise` | `guard` | Wraps a function so that if it throws, a default value is returned instead of propagating the error. |
137
134
  | `@helpers4/promise` | `meaningPromiseOrThrow` | Returns a function that passes through meaningful data or throws an error. Data is considered meanin |
138
135
  | `@helpers4/promise` | `parallel` | Runs an array of async functions with a concurrency limit. At most `limit` functions will be running |
139
- | `@helpers4/promise` | `Result` | Result tuple representing either a successful value or an error. On success: `[undefined, T]`. On er |
140
136
  | `@helpers4/promise` | `retry` | Retries a promise-returning function up to maxAttempts times |
141
137
  | `@helpers4/promise` | `timeout` | Wraps a promise to reject with a `TimeoutError` if it does not resolve within the specified duration |
142
138
  | `@helpers4/promise` | `truthyPromiseOrThrow` | Returns a function that passes through truthy data or throws an error. |
@@ -149,16 +145,19 @@ pnpm add @helpers4/version
149
145
  | `@helpers4/string` | `slugify` | Converts a string into a URL-friendly slug. |
150
146
  | `@helpers4/string` | `snakeCase` | Converts a string to snake_case. Handles camelCase, PascalCase, kebab-case, spaces, and mixed format |
151
147
  | `@helpers4/string` | `titleCase` | Converts a string to Title Case. Handles camelCase, PascalCase, kebab-case, snake_case, spaces, and |
152
- | `@helpers4/type` | `Falsy` | Union of all falsy types in JavaScript. Note: `NaN` cannot be represented as a type in TypeScript. |
153
148
  | `@helpers4/type` | `isArray` | Checks if a value is an array. |
149
+ | `@helpers4/type` | `isArrayBuffer` | Checks if a value is an ArrayBuffer instance. Useful for filtering or type-narrowing in a functiona |
154
150
  | `@helpers4/type` | `isAsyncFunction` | Checks if a value is an async function. Returns `true` for any function declared with `async`. |
155
151
  | `@helpers4/type` | `isBigInt` | Checks if a value is a bigint. |
152
+ | `@helpers4/type` | `isBlob` | Checks if a value is a Blob instance. Useful for filtering or type-narrowing in a functional pipeli |
156
153
  | `@helpers4/type` | `isBoolean` | Checks if a value is a boolean. |
154
+ | `@helpers4/type` | `isBuffer` | Checks if a value is a Node.js Buffer instance. `Buffer` extends `Uint8Array` and is specific to No |
157
155
  | `@helpers4/type` | `isDate` | Checks if a value is a Date instance. Note: this only checks the type, not whether the Date is vali |
158
156
  | `@helpers4/type` | `isDefined` | Checks if a value is defined (not undefined nor null). This is the inverse of isNullish. Use as a t |
159
157
  | `@helpers4/type` | `isEmpty` | Checks if a value is empty. Supported types: - `null` / `undefined` → empty - `string` → length === |
160
158
  | `@helpers4/type` | `isError` | Checks if a value is an Error instance. |
161
159
  | `@helpers4/type` | `isFalsy` | Checks if a value is falsy (`false`, `null`, `undefined`, `0`, `""`, `NaN`). |
160
+ | `@helpers4/type` | `isFormData` | Checks if a value is a FormData instance. Useful for filtering or type-narrowing in a functional pi |
162
161
  | `@helpers4/type` | `isFunction` | Checks if a value is a function. |
163
162
  | `@helpers4/type` | `isIterable` | Checks if a value is iterable (has a `Symbol.iterator` method). Returns `true` for strings, arrays, |
164
163
  | `@helpers4/type` | `isMap` | Checks if a value is a Map instance. |
@@ -187,10 +186,10 @@ pnpm add @helpers4/version
187
186
  | `@helpers4/type` | `isUndefined` | Checks if a value is `undefined`. |
188
187
  | `@helpers4/type` | `isValidDate` | Checks if a value is a valid Date instance (not `Invalid Date`). Unlike isDate, this also verifies |
189
188
  | `@helpers4/type` | `isValidRegex` | Checks if a string is a valid regex pattern. |
190
- | `@helpers4/type` | `Primitive` | Union of all JavaScript primitive types. |
191
189
  | `@helpers4/url` | `cleanPath` | Clean an URL by removing duplicate slashes. The protocol part of the URL is not modified. |
192
190
  | `@helpers4/url` | `extractPureURI` | Extracts the pure URI from a URL by removing query parameters and fragments. |
193
191
  | `@helpers4/url` | `onlyPath` | Extract only the path from an URI with optional query and fragments. For example, all these paramet |
192
+ | `@helpers4/url` | `parsePackageRepository` | Parse the `repository` field from `package.json` into a structured object. Supports all npm-specifi |
194
193
  | `@helpers4/url` | `relativeURLToAbsolute` | Converts a relative URL to an absolute URL using the current document base URI. |
195
194
  | `@helpers4/url` | `withLeadingSlash` | Adds a leading slash `/` to the given URL if it is not already present. This function is useful for |
196
195
  | `@helpers4/url` | `withoutLeadingSlash` | Removes the leading slash `/` from the given URL if it is present. This function is useful for ensu |
@@ -198,9 +197,10 @@ pnpm add @helpers4/version
198
197
  | `@helpers4/url` | `withTrailingSlash` | Adds a trailing slash `/` to the given URL if it is not already present. This function is useful fo |
199
198
  | `@helpers4/version` | `compare` | Compares two semantic version strings according to SemVer 2.0.0 specification Supports: - Core vers |
200
199
  | `@helpers4/version` | `increment` | Increments a semantic version |
200
+ | `@helpers4/version` | `isPrerelease` | Returns `true` when the version string has a prerelease suffix (i.e. contains a `-` after the core ` |
201
201
  | `@helpers4/version` | `parse` | Parses a semantic version string into its components according to SemVer 2.0.0 specification Suppor |
202
- | `@helpers4/version` | `ParsedVersion` | Represents a parsed semantic version according to SemVer 2.0.0 specification |
203
202
  | `@helpers4/version` | `satisfiesRange` | Checks if a version satisfies a range (simple implementation) |
203
+ | `@helpers4/version` | `stringify` | Reconstruct a semantic version string from a ParsedVersion object. This is the inverse of parse: `s |
204
204
  | `@helpers4/version` | `stripV` | Strip the leading "v" from a version string if it exists. |
205
205
 
206
206
  ---
@@ -1158,12 +1158,6 @@ compare(
1158
1158
 
1159
1159
  ---
1160
1160
 
1161
- ### `DateCompareOptions`
1162
-
1163
- Options for date comparison
1164
-
1165
- ---
1166
-
1167
1161
  ### `DateDifferenceOptions`
1168
1162
 
1169
1163
  Options for date difference calculation
@@ -1526,12 +1520,6 @@ formatDuration(-5025000) // => "-1h 23m 45s"
1526
1520
 
1527
1521
  ---
1528
1522
 
1529
- ### `FormatDurationOptions`
1530
-
1531
- Options for formatDuration.
1532
-
1533
- ---
1534
-
1535
1523
  ### `formatInTimezone`
1536
1524
 
1537
1525
  Formats a date in a specific IANA timezone using `Intl.DateTimeFormat`.
@@ -2191,12 +2179,6 @@ timeAgo('2025-01-19T00:00:00Z', { now: '2025-01-19T00:00:05Z' })
2191
2179
 
2192
2180
  ---
2193
2181
 
2194
- ### `TimeAgoOptions`
2195
-
2196
- Options for timeAgo.
2197
-
2198
- ---
2199
-
2200
2182
  ### `toISO8601`
2201
2183
 
2202
2184
  Converts a date to ISO 8601 format
@@ -2683,6 +2665,41 @@ clamp(5, 0, 10) // => 5
2683
2665
 
2684
2666
  ---
2685
2667
 
2668
+ ### `formatSize`
2669
+
2670
+ Format a byte count into a human-readable string with the appropriate unit.
2671
+
2672
+ Each unit is 1024 of the previous (binary prefix). The result is formatted
2673
+ with one decimal place.
2674
+
2675
+ ```typescript
2676
+ import { formatSize } from '@helpers4/number';
2677
+
2678
+ formatSize(bytes: number): string
2679
+ ```
2680
+
2681
+ **Parameters:**
2682
+
2683
+ - `bytes: number` — A non-negative integer representing a byte count.
2684
+
2685
+ **Returns:** `string` — A human-readable string such as `'0.0B'`, `'1.5KB'`, `'3.2MB'`.
2686
+
2687
+ **Examples:**
2688
+
2689
+ *Format bytes to human-readable size*
2690
+
2691
+ Converts a raw byte count to a human-readable string using binary prefixes.
2692
+
2693
+ ```typescript
2694
+ formatSize(0) // '0.0B'
2695
+ formatSize(512) // '512.0B'
2696
+ formatSize(1024) // '1.0KB'
2697
+ formatSize(1_048_576) // '1.0MB'
2698
+ formatSize(1_073_741_824) // '1.0GB'
2699
+ ```
2700
+
2701
+ ---
2702
+
2686
2703
  ### `randomBetween`
2687
2704
 
2688
2705
  Generates a random number between min and max (inclusive)
@@ -2954,12 +2971,6 @@ deepCompare({ a: { b: 1 } }, { a: { b: 2 } })
2954
2971
 
2955
2972
  ---
2956
2973
 
2957
- ### `DeepCompareResult`
2958
-
2959
- Result type for deep comparison when objects are not identical
2960
-
2961
- ---
2962
-
2963
2974
  ### `deepMerge`
2964
2975
 
2965
2976
  Merges two or more objects deeply
@@ -3644,13 +3655,6 @@ await parallel([fnA, fnB, fnC], 1)
3644
3655
 
3645
3656
  ---
3646
3657
 
3647
- ### `Result`
3648
-
3649
- Result tuple representing either a successful value or an error.
3650
- On success: `[undefined, T]`. On error: `[Error, undefined]`.
3651
-
3652
- ---
3653
-
3654
3658
  ### `retry`
3655
3659
 
3656
3660
  Retries a promise-returning function up to maxAttempts times
@@ -4293,13 +4297,6 @@ titleCase('queryItems')
4293
4297
 
4294
4298
  Package: `@helpers4/type`
4295
4299
 
4296
- ### `Falsy`
4297
-
4298
- Union of all falsy types in JavaScript.
4299
- Note: `NaN` cannot be represented as a type in TypeScript.
4300
-
4301
- ---
4302
-
4303
4300
  ### `isArray`
4304
4301
 
4305
4302
  Checks if a value is an array.
@@ -4307,14 +4304,14 @@ Checks if a value is an array.
4307
4304
  ```typescript
4308
4305
  import { isArray } from '@helpers4/type';
4309
4306
 
4310
- isArray(value: unknown): value
4307
+ isArray(value: unknown): value is unknown[]
4311
4308
  ```
4312
4309
 
4313
4310
  **Parameters:**
4314
4311
 
4315
4312
  - `value: unknown` — The value to check
4316
4313
 
4317
- **Returns:** `value` — True if value is an array
4314
+ **Returns:** `value is unknown[]` — True if value is an array
4318
4315
 
4319
4316
  **Examples:**
4320
4317
 
@@ -4330,6 +4327,49 @@ isArray({}) // => false
4330
4327
 
4331
4328
  ---
4332
4329
 
4330
+ ### `isArrayBuffer`
4331
+
4332
+ Checks if a value is an ArrayBuffer instance.
4333
+
4334
+ Useful for filtering or type-narrowing in a functional pipeline:
4335
+ `values.filter(isArrayBuffer)`
4336
+
4337
+ ```typescript
4338
+ import { isArrayBuffer } from '@helpers4/type';
4339
+
4340
+ isArrayBuffer(value: unknown): value is ArrayBuffer
4341
+ ```
4342
+
4343
+ **Parameters:**
4344
+
4345
+ - `value: unknown` — The value to check
4346
+
4347
+ **Returns:** `value is ArrayBuffer` — True if value is an ArrayBuffer
4348
+
4349
+ **Examples:**
4350
+
4351
+ *Detect an ArrayBuffer*
4352
+
4353
+ Returns true only for ArrayBuffer instances, not TypedArray views.
4354
+
4355
+ ```typescript
4356
+ isArrayBuffer(new ArrayBuffer(8)) // => true
4357
+ isArrayBuffer(new Uint8Array(8)) // => false
4358
+ isArrayBuffer('hello') // => false
4359
+ ```
4360
+
4361
+ *Filter ArrayBuffers from a mixed array*
4362
+
4363
+ Use as a predicate in .filter() to extract ArrayBuffer values.
4364
+
4365
+ ```typescript
4366
+ const values = [new ArrayBuffer(4), 'text', new ArrayBuffer(8), 42];
4367
+ values.filter(isArrayBuffer)
4368
+ // => [ArrayBuffer(4), ArrayBuffer(8)]
4369
+ ```
4370
+
4371
+ ---
4372
+
4333
4373
  ### `isAsyncFunction`
4334
4374
 
4335
4375
  Checks if a value is an async function.
@@ -4339,14 +4379,14 @@ Returns `true` for any function declared with `async`.
4339
4379
  ```typescript
4340
4380
  import { isAsyncFunction } from '@helpers4/type';
4341
4381
 
4342
- isAsyncFunction(value: unknown): value
4382
+ isAsyncFunction(value: unknown): value is function
4343
4383
  ```
4344
4384
 
4345
4385
  **Parameters:**
4346
4386
 
4347
4387
  - `value: unknown` — The value to check
4348
4388
 
4349
- **Returns:** `value` — True if value is an async function
4389
+ **Returns:** `value is function` — True if value is an async function
4350
4390
 
4351
4391
  **Examples:**
4352
4392
 
@@ -4370,14 +4410,14 @@ Checks if a value is a bigint.
4370
4410
  ```typescript
4371
4411
  import { isBigInt } from '@helpers4/type';
4372
4412
 
4373
- isBigInt(value: unknown): value
4413
+ isBigInt(value: unknown): value is bigint
4374
4414
  ```
4375
4415
 
4376
4416
  **Parameters:**
4377
4417
 
4378
4418
  - `value: unknown` — The value to check
4379
4419
 
4380
- **Returns:** `value` — True if value is a bigint
4420
+ **Returns:** `value is bigint` — True if value is a bigint
4381
4421
 
4382
4422
  **Examples:**
4383
4423
 
@@ -4393,6 +4433,49 @@ isBigInt('42') // => false
4393
4433
 
4394
4434
  ---
4395
4435
 
4436
+ ### `isBlob`
4437
+
4438
+ Checks if a value is a Blob instance.
4439
+
4440
+ Useful for filtering or type-narrowing in a functional pipeline:
4441
+ `values.filter(isBlob)`
4442
+
4443
+ ```typescript
4444
+ import { isBlob } from '@helpers4/type';
4445
+
4446
+ isBlob(value: unknown): value is Blob
4447
+ ```
4448
+
4449
+ **Parameters:**
4450
+
4451
+ - `value: unknown` — The value to check
4452
+
4453
+ **Returns:** `value is Blob` — True if value is a Blob
4454
+
4455
+ **Examples:**
4456
+
4457
+ *Detect a Blob*
4458
+
4459
+ Returns true only for Blob instances.
4460
+
4461
+ ```typescript
4462
+ isBlob(new Blob(['hello'])) // => true
4463
+ isBlob(new Blob([], { type: 'application/json' })) // => true
4464
+ isBlob('hello') // => false
4465
+ ```
4466
+
4467
+ *Filter Blobs from a mixed array*
4468
+
4469
+ Use as a predicate in .filter() to extract Blob values.
4470
+
4471
+ ```typescript
4472
+ const values = [new Blob(['a']), 'text', new Blob(['b']), 42];
4473
+ values.filter(isBlob)
4474
+ // => [Blob, Blob]
4475
+ ```
4476
+
4477
+ ---
4478
+
4396
4479
  ### `isBoolean`
4397
4480
 
4398
4481
  Checks if a value is a boolean.
@@ -4400,14 +4483,14 @@ Checks if a value is a boolean.
4400
4483
  ```typescript
4401
4484
  import { isBoolean } from '@helpers4/type';
4402
4485
 
4403
- isBoolean(value: unknown): value
4486
+ isBoolean(value: unknown): value is boolean
4404
4487
  ```
4405
4488
 
4406
4489
  **Parameters:**
4407
4490
 
4408
4491
  - `value: unknown` — The value to check
4409
4492
 
4410
- **Returns:** `value` — True if value is a boolean
4493
+ **Returns:** `value is boolean` — True if value is a boolean
4411
4494
 
4412
4495
  **Examples:**
4413
4496
 
@@ -4423,6 +4506,53 @@ isBoolean(1) // => false
4423
4506
 
4424
4507
  ---
4425
4508
 
4509
+ ### `isBuffer`
4510
+
4511
+ Checks if a value is a Node.js Buffer instance.
4512
+
4513
+ `Buffer` extends `Uint8Array` and is specific to Node.js, Bun, and Deno.
4514
+ In browser-only environments where `Buffer` is not defined, this function
4515
+ always returns `false`.
4516
+
4517
+ Useful for filtering or type-narrowing in a functional pipeline:
4518
+ `values.filter(isBuffer)`
4519
+
4520
+ ```typescript
4521
+ import { isBuffer } from '@helpers4/type';
4522
+
4523
+ isBuffer(value: unknown): value is Buffer<ArrayBufferLike>
4524
+ ```
4525
+
4526
+ **Parameters:**
4527
+
4528
+ - `value: unknown` — The value to check
4529
+
4530
+ **Returns:** `value is Buffer<ArrayBufferLike>` — True if value is a Buffer
4531
+
4532
+ **Examples:**
4533
+
4534
+ *Detect a Node.js Buffer*
4535
+
4536
+ Returns true only for Buffer instances. Uint8Array is not a Buffer.
4537
+
4538
+ ```typescript
4539
+ isBuffer(Buffer.from('hello')) // => true
4540
+ isBuffer(new Uint8Array(8)) // => false
4541
+ isBuffer('hello') // => false
4542
+ ```
4543
+
4544
+ *Filter Buffers from a mixed array*
4545
+
4546
+ Use as a predicate in .filter() to extract Buffer values.
4547
+
4548
+ ```typescript
4549
+ const values = [Buffer.from('a'), 'text', Buffer.alloc(4), 42];
4550
+ values.filter(isBuffer)
4551
+ // => [Buffer, Buffer]
4552
+ ```
4553
+
4554
+ ---
4555
+
4426
4556
  ### `isDate`
4427
4557
 
4428
4558
  Checks if a value is a Date instance.
@@ -4433,14 +4563,14 @@ Use isValidDate to also validate that the Date is not `Invalid Date`.
4433
4563
  ```typescript
4434
4564
  import { isDate } from '@helpers4/type';
4435
4565
 
4436
- isDate(value: unknown): value
4566
+ isDate(value: unknown): value is Date
4437
4567
  ```
4438
4568
 
4439
4569
  **Parameters:**
4440
4570
 
4441
4571
  - `value: unknown` — The value to check
4442
4572
 
4443
- **Returns:** `value` — True if value is a Date instance
4573
+ **Returns:** `value is Date` — True if value is a Date instance
4444
4574
 
4445
4575
  **Examples:**
4446
4576
 
@@ -4467,14 +4597,14 @@ Use as a type-safe filter callback to remove `null`/`undefined` from arrays.
4467
4597
  ```typescript
4468
4598
  import { isDefined } from '@helpers4/type';
4469
4599
 
4470
- isDefined<T>(value: Maybe<T>): value
4600
+ isDefined<T>(value: Maybe<T>): value is T
4471
4601
  ```
4472
4602
 
4473
4603
  **Parameters:**
4474
4604
 
4475
4605
  - `value: Maybe<T>` — The value to check
4476
4606
 
4477
- **Returns:** `value` — True if value is not undefined nor null
4607
+ **Returns:** `value is T` — True if value is not undefined nor null
4478
4608
 
4479
4609
  **Examples:**
4480
4610
 
@@ -4557,14 +4687,14 @@ Checks if a value is an Error instance.
4557
4687
  ```typescript
4558
4688
  import { isError } from '@helpers4/type';
4559
4689
 
4560
- isError(value: unknown): value
4690
+ isError(value: unknown): value is Error
4561
4691
  ```
4562
4692
 
4563
4693
  **Parameters:**
4564
4694
 
4565
4695
  - `value: unknown` — The value to check
4566
4696
 
4567
- **Returns:** `value` — True if value is an Error (or subclass like TypeError, RangeError, etc.)
4697
+ **Returns:** `value is Error` — True if value is an Error (or subclass like TypeError, RangeError, etc.)
4568
4698
 
4569
4699
  **Examples:**
4570
4700
 
@@ -4587,14 +4717,14 @@ Checks if a value is falsy (`false`, `null`, `undefined`, `0`, `""`, `NaN`).
4587
4717
  ```typescript
4588
4718
  import { isFalsy } from '@helpers4/type';
4589
4719
 
4590
- isFalsy(value: unknown): value
4720
+ isFalsy(value: unknown): value is Falsy
4591
4721
  ```
4592
4722
 
4593
4723
  **Parameters:**
4594
4724
 
4595
4725
  - `value: unknown` — The value to check
4596
4726
 
4597
- **Returns:** `value` — True if the value is falsy
4727
+ **Returns:** `value is Falsy` — True if the value is falsy
4598
4728
 
4599
4729
  **Examples:**
4600
4730
 
@@ -4611,6 +4741,51 @@ isFalsy('hello') // => false
4611
4741
 
4612
4742
  ---
4613
4743
 
4744
+ ### `isFormData`
4745
+
4746
+ Checks if a value is a FormData instance.
4747
+
4748
+ Useful for filtering or type-narrowing in a functional pipeline:
4749
+ `values.filter(isFormData)`
4750
+
4751
+ ```typescript
4752
+ import { isFormData } from '@helpers4/type';
4753
+
4754
+ isFormData(value: unknown): value is FormData
4755
+ ```
4756
+
4757
+ **Parameters:**
4758
+
4759
+ - `value: unknown` — The value to check
4760
+
4761
+ **Returns:** `value is FormData` — True if value is a FormData
4762
+
4763
+ **Examples:**
4764
+
4765
+ *Detect a FormData*
4766
+
4767
+ Returns true only for FormData instances.
4768
+
4769
+ ```typescript
4770
+ isFormData(new FormData()) // => true
4771
+ isFormData({}) // => false
4772
+ isFormData(null) // => false
4773
+ ```
4774
+
4775
+ *Filter FormData from a mixed array*
4776
+
4777
+ Use as a predicate in .filter() to extract FormData values.
4778
+
4779
+ ```typescript
4780
+ const fd = new FormData();
4781
+ fd.append('name', 'Alice');
4782
+ const values = [fd, {}, new FormData(), 'text'];
4783
+ values.filter(isFormData)
4784
+ // => [FormData, FormData]
4785
+ ```
4786
+
4787
+ ---
4788
+
4614
4789
  ### `isFunction`
4615
4790
 
4616
4791
  Checks if a value is a function.
@@ -4618,14 +4793,14 @@ Checks if a value is a function.
4618
4793
  ```typescript
4619
4794
  import { isFunction } from '@helpers4/type';
4620
4795
 
4621
- isFunction(value: unknown): value
4796
+ isFunction(value: unknown): value is Function
4622
4797
  ```
4623
4798
 
4624
4799
  **Parameters:**
4625
4800
 
4626
4801
  - `value: unknown` — The value to check
4627
4802
 
4628
- **Returns:** `value` — True if value is a function
4803
+ **Returns:** `value is Function` — True if value is a function
4629
4804
 
4630
4805
  **Examples:**
4631
4806
 
@@ -4651,14 +4826,14 @@ implementing the iterable protocol.
4651
4826
  ```typescript
4652
4827
  import { isIterable } from '@helpers4/type';
4653
4828
 
4654
- isIterable(value: unknown): value
4829
+ isIterable(value: unknown): value is Iterable<unknown, any, any>
4655
4830
  ```
4656
4831
 
4657
4832
  **Parameters:**
4658
4833
 
4659
4834
  - `value: unknown` — The value to check
4660
4835
 
4661
- **Returns:** `value` — True if value is iterable
4836
+ **Returns:** `value is Iterable<unknown, any, any>` — True if value is iterable
4662
4837
 
4663
4838
  **Examples:**
4664
4839
 
@@ -4684,14 +4859,14 @@ Checks if a value is a Map instance.
4684
4859
  ```typescript
4685
4860
  import { isMap } from '@helpers4/type';
4686
4861
 
4687
- isMap(value: unknown): value
4862
+ isMap(value: unknown): value is Map<unknown, unknown>
4688
4863
  ```
4689
4864
 
4690
4865
  **Parameters:**
4691
4866
 
4692
4867
  - `value: unknown` — The value to check
4693
4868
 
4694
- **Returns:** `value` — True if value is a Map
4869
+ **Returns:** `value is Map<unknown, unknown>` — True if value is a Map
4695
4870
 
4696
4871
  **Examples:**
4697
4872
 
@@ -4716,14 +4891,14 @@ Returns `false` for `NaN`, `0`, positive numbers, and non-number types.
4716
4891
  ```typescript
4717
4892
  import { isNegativeNumber } from '@helpers4/type';
4718
4893
 
4719
- isNegativeNumber(value: unknown): value
4894
+ isNegativeNumber(value: unknown): value is number
4720
4895
  ```
4721
4896
 
4722
4897
  **Parameters:**
4723
4898
 
4724
4899
  - `value: unknown` — The value to check
4725
4900
 
4726
- **Returns:** `value` — True if value is a negative number
4901
+ **Returns:** `value is number` — True if value is a negative number
4727
4902
 
4728
4903
  **Examples:**
4729
4904
 
@@ -4748,14 +4923,14 @@ Checks if a value is a non-empty array (length > 0).
4748
4923
  ```typescript
4749
4924
  import { isNonEmptyArray } from '@helpers4/type';
4750
4925
 
4751
- isNonEmptyArray(value: unknown): value
4926
+ isNonEmptyArray(value: unknown): value is [unknown, rest]
4752
4927
  ```
4753
4928
 
4754
4929
  **Parameters:**
4755
4930
 
4756
4931
  - `value: unknown` — The value to check
4757
4932
 
4758
- **Returns:** `value` — True if value is an array with at least one element
4933
+ **Returns:** `value is [unknown, rest]` — True if value is an array with at least one element
4759
4934
 
4760
4935
  **Examples:**
4761
4936
 
@@ -4779,14 +4954,14 @@ Checks if a value is a non-empty string (length > 0).
4779
4954
  ```typescript
4780
4955
  import { isNonEmptyString } from '@helpers4/type';
4781
4956
 
4782
- isNonEmptyString(value: unknown): value
4957
+ isNonEmptyString(value: unknown): value is string
4783
4958
  ```
4784
4959
 
4785
4960
  **Parameters:**
4786
4961
 
4787
4962
  - `value: unknown` — The value to check
4788
4963
 
4789
- **Returns:** `value` — True if value is a string with at least one character
4964
+ **Returns:** `value is string` — True if value is a string with at least one character
4790
4965
 
4791
4966
  **Examples:**
4792
4967
 
@@ -4810,14 +4985,14 @@ Checks if a value is `null`.
4810
4985
  ```typescript
4811
4986
  import { isNull } from '@helpers4/type';
4812
4987
 
4813
- isNull(value: unknown): value
4988
+ isNull(value: unknown): value is null
4814
4989
  ```
4815
4990
 
4816
4991
  **Parameters:**
4817
4992
 
4818
4993
  - `value: unknown` — The value to check
4819
4994
 
4820
- **Returns:** `value` — True if value is null
4995
+ **Returns:** `value is null` — True if value is null
4821
4996
 
4822
4997
  **Examples:**
4823
4998
 
@@ -4840,14 +5015,14 @@ Checks if a value is null or undefined (nullish).
4840
5015
  ```typescript
4841
5016
  import { isNullish } from '@helpers4/type';
4842
5017
 
4843
- isNullish(value: unknown): value
5018
+ isNullish(value: unknown): value is null | undefined
4844
5019
  ```
4845
5020
 
4846
5021
  **Parameters:**
4847
5022
 
4848
5023
  - `value: unknown` — The value to check
4849
5024
 
4850
- **Returns:** `value` — True if value is null or undefined
5025
+ **Returns:** `value is null | undefined` — True if value is null or undefined
4851
5026
 
4852
5027
  **Examples:**
4853
5028
 
@@ -4886,14 +5061,14 @@ to increase user-friendliness.
4886
5061
  ```typescript
4887
5062
  import { isNumber } from '@helpers4/type';
4888
5063
 
4889
- isNumber(value: unknown): value
5064
+ isNumber(value: unknown): value is number
4890
5065
  ```
4891
5066
 
4892
5067
  **Parameters:**
4893
5068
 
4894
5069
  - `value: unknown` — The value to check
4895
5070
 
4896
- **Returns:** `value` — True if value is a number (excludes NaN)
5071
+ **Returns:** `value is number` — True if value is a number (excludes NaN)
4897
5072
 
4898
5073
  **Examples:**
4899
5074
 
@@ -4920,14 +5095,14 @@ Returns `false` for arrays, Date, Map, Set, RegExp, class instances, etc.
4920
5095
  ```typescript
4921
5096
  import { isPlainObject } from '@helpers4/type';
4922
5097
 
4923
- isPlainObject(value: unknown): value
5098
+ isPlainObject(value: unknown): value is Record<string, unknown>
4924
5099
  ```
4925
5100
 
4926
5101
  **Parameters:**
4927
5102
 
4928
5103
  - `value: unknown` — The value to check
4929
5104
 
4930
- **Returns:** `value` — True if value is a plain object
5105
+ **Returns:** `value is Record<string, unknown>` — True if value is a plain object
4931
5106
 
4932
5107
  **Examples:**
4933
5108
 
@@ -4954,14 +5129,14 @@ Returns `false` for `NaN`, `0`, negative numbers, and non-number types.
4954
5129
  ```typescript
4955
5130
  import { isPositiveNumber } from '@helpers4/type';
4956
5131
 
4957
- isPositiveNumber(value: unknown): value
5132
+ isPositiveNumber(value: unknown): value is number
4958
5133
  ```
4959
5134
 
4960
5135
  **Parameters:**
4961
5136
 
4962
5137
  - `value: unknown` — The value to check
4963
5138
 
4964
- **Returns:** `value` — True if value is a positive number
5139
+ **Returns:** `value is number` — True if value is a positive number
4965
5140
 
4966
5141
  **Examples:**
4967
5142
 
@@ -4988,14 +5163,14 @@ Primitive types: `string`, `number`, `boolean`, `bigint`, `symbol`, `null`, `und
4988
5163
  ```typescript
4989
5164
  import { isPrimitive } from '@helpers4/type';
4990
5165
 
4991
- isPrimitive(value: unknown): value
5166
+ isPrimitive(value: unknown): value is Primitive
4992
5167
  ```
4993
5168
 
4994
5169
  **Parameters:**
4995
5170
 
4996
5171
  - `value: unknown` — The value to check
4997
5172
 
4998
- **Returns:** `value` — True if value is a primitive
5173
+ **Returns:** `value is Primitive` — True if value is a primitive
4999
5174
 
5000
5175
  **Examples:**
5001
5176
 
@@ -5023,14 +5198,14 @@ including native Promises and userland implementations.
5023
5198
  ```typescript
5024
5199
  import { isPromise } from '@helpers4/type';
5025
5200
 
5026
- isPromise(value: unknown): value
5201
+ isPromise(value: unknown): value is PromiseLike<unknown>
5027
5202
  ```
5028
5203
 
5029
5204
  **Parameters:**
5030
5205
 
5031
5206
  - `value: unknown` — The value to check
5032
5207
 
5033
- **Returns:** `value` — True if value is a Promise-like object
5208
+ **Returns:** `value is PromiseLike<unknown>` — True if value is a Promise-like object
5034
5209
 
5035
5210
  **Examples:**
5036
5211
 
@@ -5054,14 +5229,14 @@ Checks if a value is a RegExp instance.
5054
5229
  ```typescript
5055
5230
  import { isRegExp } from '@helpers4/type';
5056
5231
 
5057
- isRegExp(value: unknown): value
5232
+ isRegExp(value: unknown): value is RegExp
5058
5233
  ```
5059
5234
 
5060
5235
  **Parameters:**
5061
5236
 
5062
5237
  - `value: unknown` — The value to check
5063
5238
 
5064
- **Returns:** `value` — True if value is a RegExp
5239
+ **Returns:** `value is RegExp` — True if value is a RegExp
5065
5240
 
5066
5241
  **Examples:**
5067
5242
 
@@ -5124,14 +5299,14 @@ Checks if a value is a string.
5124
5299
  ```typescript
5125
5300
  import { isString } from '@helpers4/type';
5126
5301
 
5127
- isString(value: unknown): value
5302
+ isString(value: unknown): value is string
5128
5303
  ```
5129
5304
 
5130
5305
  **Parameters:**
5131
5306
 
5132
5307
  - `value: unknown` — The value to check
5133
5308
 
5134
- **Returns:** `value` — True if value is a string
5309
+ **Returns:** `value is string` — True if value is a string
5135
5310
 
5136
5311
  **Examples:**
5137
5312
 
@@ -5153,14 +5328,14 @@ Checks if a value is a symbol.
5153
5328
  ```typescript
5154
5329
  import { isSymbol } from '@helpers4/type';
5155
5330
 
5156
- isSymbol(value: unknown): value
5331
+ isSymbol(value: unknown): value is symbol
5157
5332
  ```
5158
5333
 
5159
5334
  **Parameters:**
5160
5335
 
5161
5336
  - `value: unknown` — The value to check
5162
5337
 
5163
- **Returns:** `value` — True if value is a symbol
5338
+ **Returns:** `value is symbol` — True if value is a symbol
5164
5339
 
5165
5340
  **Examples:**
5166
5341
 
@@ -5186,14 +5361,14 @@ to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).
5186
5361
  ```typescript
5187
5362
  import { isTemporalDuration } from '@helpers4/type';
5188
5363
 
5189
- isTemporalDuration(value: unknown): value
5364
+ isTemporalDuration(value: unknown): value is Duration
5190
5365
  ```
5191
5366
 
5192
5367
  **Parameters:**
5193
5368
 
5194
5369
  - `value: unknown` — The value to check
5195
5370
 
5196
- **Returns:** `value` — True if value is a `Temporal.Duration`
5371
+ **Returns:** `value is Duration` — True if value is a `Temporal.Duration`
5197
5372
 
5198
5373
  **Examples:**
5199
5374
 
@@ -5219,14 +5394,14 @@ to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).
5219
5394
  ```typescript
5220
5395
  import { isTemporalInstant } from '@helpers4/type';
5221
5396
 
5222
- isTemporalInstant(value: unknown): value
5397
+ isTemporalInstant(value: unknown): value is Instant
5223
5398
  ```
5224
5399
 
5225
5400
  **Parameters:**
5226
5401
 
5227
5402
  - `value: unknown` — The value to check
5228
5403
 
5229
- **Returns:** `value` — True if value is a `Temporal.Instant`
5404
+ **Returns:** `value is Instant` — True if value is a `Temporal.Instant`
5230
5405
 
5231
5406
  **Examples:**
5232
5407
 
@@ -5252,14 +5427,14 @@ to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).
5252
5427
  ```typescript
5253
5428
  import { isTemporalPlainDate } from '@helpers4/type';
5254
5429
 
5255
- isTemporalPlainDate(value: unknown): value
5430
+ isTemporalPlainDate(value: unknown): value is PlainDate
5256
5431
  ```
5257
5432
 
5258
5433
  **Parameters:**
5259
5434
 
5260
5435
  - `value: unknown` — The value to check
5261
5436
 
5262
- **Returns:** `value` — True if value is a `Temporal.PlainDate`
5437
+ **Returns:** `value is PlainDate` — True if value is a `Temporal.PlainDate`
5263
5438
 
5264
5439
  **Examples:**
5265
5440
 
@@ -5285,14 +5460,14 @@ to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).
5285
5460
  ```typescript
5286
5461
  import { isTemporalPlainDateTime } from '@helpers4/type';
5287
5462
 
5288
- isTemporalPlainDateTime(value: unknown): value
5463
+ isTemporalPlainDateTime(value: unknown): value is PlainDateTime
5289
5464
  ```
5290
5465
 
5291
5466
  **Parameters:**
5292
5467
 
5293
5468
  - `value: unknown` — The value to check
5294
5469
 
5295
- **Returns:** `value` — True if value is a `Temporal.PlainDateTime`
5470
+ **Returns:** `value is PlainDateTime` — True if value is a `Temporal.PlainDateTime`
5296
5471
 
5297
5472
  **Examples:**
5298
5473
 
@@ -5318,14 +5493,14 @@ to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).
5318
5493
  ```typescript
5319
5494
  import { isTemporalPlainTime } from '@helpers4/type';
5320
5495
 
5321
- isTemporalPlainTime(value: unknown): value
5496
+ isTemporalPlainTime(value: unknown): value is PlainTime
5322
5497
  ```
5323
5498
 
5324
5499
  **Parameters:**
5325
5500
 
5326
5501
  - `value: unknown` — The value to check
5327
5502
 
5328
- **Returns:** `value` — True if value is a `Temporal.PlainTime`
5503
+ **Returns:** `value is PlainTime` — True if value is a `Temporal.PlainTime`
5329
5504
 
5330
5505
  **Examples:**
5331
5506
 
@@ -5351,14 +5526,14 @@ to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).
5351
5526
  ```typescript
5352
5527
  import { isTemporalZonedDateTime } from '@helpers4/type';
5353
5528
 
5354
- isTemporalZonedDateTime(value: unknown): value
5529
+ isTemporalZonedDateTime(value: unknown): value is ZonedDateTime
5355
5530
  ```
5356
5531
 
5357
5532
  **Parameters:**
5358
5533
 
5359
5534
  - `value: unknown` — The value to check
5360
5535
 
5361
- **Returns:** `value` — True if value is a `Temporal.ZonedDateTime`
5536
+ **Returns:** `value is ZonedDateTime` — True if value is a `Temporal.ZonedDateTime`
5362
5537
 
5363
5538
  **Examples:**
5364
5539
 
@@ -5388,14 +5563,14 @@ numbers ≤ ~7.26 billion are treated as seconds, larger as milliseconds.
5388
5563
  ```typescript
5389
5564
  import { isTimestamp } from '@helpers4/type';
5390
5565
 
5391
- isTimestamp(value: unknown): value
5566
+ isTimestamp(value: unknown): value is number
5392
5567
  ```
5393
5568
 
5394
5569
  **Parameters:**
5395
5570
 
5396
5571
  - `value: unknown` — The value to check
5397
5572
 
5398
- **Returns:** `value` — True if value is a number that represents a valid timestamp
5573
+ **Returns:** `value is number` — True if value is a number that represents a valid timestamp
5399
5574
 
5400
5575
  **Examples:**
5401
5576
 
@@ -5424,14 +5599,14 @@ resulting array type by excluding falsy values.
5424
5599
  ```typescript
5425
5600
  import { isTruthy } from '@helpers4/type';
5426
5601
 
5427
- isTruthy<T>(value: Falsy | T): value
5602
+ isTruthy<T>(value: Falsy | T): value is T
5428
5603
  ```
5429
5604
 
5430
5605
  **Parameters:**
5431
5606
 
5432
5607
  - `value: Falsy | T` — The value to check
5433
5608
 
5434
- **Returns:** `value` — True if the value is truthy
5609
+ **Returns:** `value is T` — True if the value is truthy
5435
5610
 
5436
5611
  **Examples:**
5437
5612
 
@@ -5465,14 +5640,14 @@ Checks if a value is `undefined`.
5465
5640
  ```typescript
5466
5641
  import { isUndefined } from '@helpers4/type';
5467
5642
 
5468
- isUndefined(value: unknown): value
5643
+ isUndefined(value: unknown): value is undefined
5469
5644
  ```
5470
5645
 
5471
5646
  **Parameters:**
5472
5647
 
5473
5648
  - `value: unknown` — The value to check
5474
5649
 
5475
- **Returns:** `value` — True if value is undefined
5650
+ **Returns:** `value is undefined` — True if value is undefined
5476
5651
 
5477
5652
  **Examples:**
5478
5653
 
@@ -5497,14 +5672,14 @@ Unlike isDate, this also verifies that the internal timestamp is not `NaN`.
5497
5672
  ```typescript
5498
5673
  import { isValidDate } from '@helpers4/type';
5499
5674
 
5500
- isValidDate(value: unknown): value
5675
+ isValidDate(value: unknown): value is Date
5501
5676
  ```
5502
5677
 
5503
5678
  **Parameters:**
5504
5679
 
5505
5680
  - `value: unknown` — The value to check
5506
5681
 
5507
- **Returns:** `value` — True if value is a Date instance with a valid time value
5682
+ **Returns:** `value is Date` — True if value is a Date instance with a valid time value
5508
5683
 
5509
5684
  **Examples:**
5510
5685
 
@@ -5550,12 +5725,6 @@ isValidRegex('[') // => false
5550
5725
 
5551
5726
  ---
5552
5727
 
5553
- ### `Primitive`
5554
-
5555
- Union of all JavaScript primitive types.
5556
-
5557
- ---
5558
-
5559
5728
  ## url
5560
5729
 
5561
5730
  Package: `@helpers4/url`
@@ -5720,6 +5889,62 @@ onlyPath('/path?query=thing#fragment')
5720
5889
 
5721
5890
  ---
5722
5891
 
5892
+ ### `parsePackageRepository`
5893
+
5894
+ Parse the `repository` field from `package.json` into a structured object.
5895
+
5896
+ Supports all npm-specified formats:
5897
+ - **Object form**: `{ "type": "git", "url": "...", "directory": "..." }`
5898
+ - **GitHub shorthand**: `"owner/repo"` or `"github:owner/repo"`
5899
+ - **Platform shorthands**: `"gitlab:owner/repo"`, `"bitbucket:owner/repo"`
5900
+ - **Gist shorthand**: `"gist:<id>"`
5901
+ - **URL forms**: `git+https://`, `https://`, `git://`, `git@` SSH, `git+ssh://`
5902
+
5903
+ Returns `undefined` for `null`, `undefined`, arrays, or values that cannot
5904
+ be matched to any recognised format.
5905
+
5906
+ ```typescript
5907
+ import { parsePackageRepository } from '@helpers4/url';
5908
+
5909
+ parsePackageRepository(repository: unknown): PackageRepository | undefined
5910
+ ```
5911
+
5912
+ **Parameters:**
5913
+
5914
+ - `repository: unknown` — The `repository` field value from `package.json`.
5915
+
5916
+ **Returns:** `PackageRepository | undefined` — A parsed PackageRepository object, or `undefined` if the
5917
+ input cannot be parsed.
5918
+
5919
+ **Examples:**
5920
+
5921
+ *Parse the npm canonical object form*
5922
+
5923
+ Parses the full object form written by npm publish.
5924
+
5925
+ ```typescript
5926
+ parsePackageRepository({ type: 'git', url: 'git+https://github.com/helpers4/typescript.git' })
5927
+ // => { type: 'git', host: 'github', slug: 'helpers4/typescript',
5928
+ // owner: 'helpers4', repo: 'typescript', gistId: undefined, directory: undefined }
5929
+ ```
5930
+
5931
+ *Parse npm shorthand forms*
5932
+
5933
+ npm accepts "owner/repo", "github:owner/repo", "gitlab:owner/repo" etc. as shorthand.
5934
+
5935
+ ```typescript
5936
+ parsePackageRepository('helpers4/typescript')
5937
+ // => { host: 'github', slug: 'helpers4/typescript', owner: 'helpers4', repo: 'typescript', ... }
5938
+
5939
+ parsePackageRepository('gitlab:myorg/myproject')
5940
+ // => { host: 'gitlab', slug: 'myorg/myproject', owner: 'myorg', repo: 'myproject', ... }
5941
+
5942
+ parsePackageRepository('gist:11081aaa281')
5943
+ // => { host: 'gist', gistId: '11081aaa281', slug: undefined, owner: undefined, ... }
5944
+ ```
5945
+
5946
+ ---
5947
+
5723
5948
  ### `relativeURLToAbsolute`
5724
5949
 
5725
5950
  Converts a relative URL to an absolute URL using the current document base URI.
@@ -6110,6 +6335,90 @@ increment('v1.0.0', 'major')
6110
6335
 
6111
6336
  ---
6112
6337
 
6338
+ ### `isPrerelease`
6339
+
6340
+ Returns `true` when the version string has a prerelease suffix
6341
+ (i.e. contains a `-` after the core `MAJOR.MINOR.PATCH`).
6342
+
6343
+ ```typescript
6344
+ import { isPrerelease } from '@helpers4/version';
6345
+
6346
+ isPrerelease(version: string): boolean
6347
+ ```
6348
+
6349
+ **Parameters:**
6350
+
6351
+ - `version: string` — A semantic version string (e.g. `'2.0.0-alpha.1'`, `'1.0.0'`).
6352
+
6353
+ **Returns:** `boolean` — `true` if the version is a prerelease, `false` otherwise.
6354
+
6355
+ ```typescript
6356
+ import { isPrerelease } from '@helpers4/version';
6357
+
6358
+ isPrerelease(version: ParsedVersion): boolean
6359
+ ```
6360
+
6361
+ **Parameters:**
6362
+
6363
+ - `version: ParsedVersion` — A ParsedVersion object (as returned by parse).
6364
+
6365
+ **Returns:** `boolean` — `true` if `version.prerelease` is non-empty, `false` otherwise.
6366
+
6367
+ ```typescript
6368
+ import { isPrerelease } from '@helpers4/version';
6369
+
6370
+ isPrerelease(version: undefined): undefined
6371
+ ```
6372
+
6373
+ **Parameters:**
6374
+
6375
+ - `version: undefined` — A semantic version string (e.g. `'2.0.0-alpha.1'`, `'1.0.0'`).
6376
+
6377
+ **Returns:** `undefined` — `true` if the version is a prerelease, `false` otherwise.
6378
+
6379
+ ```typescript
6380
+ import { isPrerelease } from '@helpers4/version';
6381
+
6382
+ isPrerelease(version: null): null
6383
+ ```
6384
+
6385
+ **Parameters:**
6386
+
6387
+ - `version: null` — A semantic version string (e.g. `'2.0.0-alpha.1'`, `'1.0.0'`).
6388
+
6389
+ **Returns:** `null` — `true` if the version is a prerelease, `false` otherwise.
6390
+
6391
+ **Examples:**
6392
+
6393
+ *Detect a prerelease version*
6394
+
6395
+ Returns true for any version string that contains a prerelease suffix.
6396
+
6397
+ ```typescript
6398
+ isPrerelease('2.0.0-alpha.1') // true
6399
+ isPrerelease('1.0.0-rc.0') // true
6400
+ ```
6401
+
6402
+ *Stable versions return false*
6403
+
6404
+ Returns false when the version has no prerelease suffix.
6405
+
6406
+ ```typescript
6407
+ isPrerelease('1.0.0') // false
6408
+ isPrerelease('2.1.3') // false
6409
+ ```
6410
+
6411
+ *Accept a ParsedVersion object*
6412
+
6413
+ Works with the result of parse() — checks the prerelease array instead of string matching.
6414
+
6415
+ ```typescript
6416
+ isPrerelease(parse('2.0.0-alpha.1')) // true
6417
+ isPrerelease(parse('1.0.0')) // false
6418
+ ```
6419
+
6420
+ ---
6421
+
6113
6422
  ### `parse`
6114
6423
 
6115
6424
  Parses a semantic version string into its components according to SemVer 2.0.0 specification
@@ -6178,12 +6487,6 @@ parse('v2.0.0-alpha.1')
6178
6487
 
6179
6488
  ---
6180
6489
 
6181
- ### `ParsedVersion`
6182
-
6183
- Represents a parsed semantic version according to SemVer 2.0.0 specification
6184
-
6185
- ---
6186
-
6187
6490
  ### `satisfiesRange`
6188
6491
 
6189
6492
  Checks if a version satisfies a range (simple implementation)
@@ -6232,6 +6535,74 @@ satisfiesRange('0.9.0', '>=1.0.0')
6232
6535
 
6233
6536
  ---
6234
6537
 
6538
+ ### `stringify`
6539
+
6540
+ Reconstruct a semantic version string from a ParsedVersion object.
6541
+
6542
+ This is the inverse of parse:
6543
+ `stringify(parse(v)) === stripV(v)` for any valid SemVer string `v`.
6544
+
6545
+ ```typescript
6546
+ import { stringify } from '@helpers4/version';
6547
+
6548
+ stringify(parsed: ParsedVersion): string
6549
+ ```
6550
+
6551
+ **Parameters:**
6552
+
6553
+ - `parsed: ParsedVersion` — A parsed semantic version object.
6554
+
6555
+ **Returns:** `string` — The reconstructed version string (without leading `v`).
6556
+
6557
+ ```typescript
6558
+ import { stringify } from '@helpers4/version';
6559
+
6560
+ stringify(parsed: undefined): undefined
6561
+ ```
6562
+
6563
+ **Parameters:**
6564
+
6565
+ - `parsed: undefined` — A parsed semantic version object.
6566
+
6567
+ **Returns:** `undefined` — The reconstructed version string (without leading `v`).
6568
+
6569
+ ```typescript
6570
+ import { stringify } from '@helpers4/version';
6571
+
6572
+ stringify(parsed: null): null
6573
+ ```
6574
+
6575
+ **Parameters:**
6576
+
6577
+ - `parsed: null` — A parsed semantic version object.
6578
+
6579
+ **Returns:** `null` — The reconstructed version string (without leading `v`).
6580
+
6581
+ **Examples:**
6582
+
6583
+ *Reconstruct a stable version*
6584
+
6585
+ Converts a ParsedVersion object back to a version string.
6586
+
6587
+ ```typescript
6588
+ stringify({ major: 1, minor: 2, patch: 3, prerelease: [], build: [] })
6589
+ // => '1.2.3'
6590
+ ```
6591
+
6592
+ *Round-trip with parse*
6593
+
6594
+ stringify(parse(v)) returns the original version string (without leading v).
6595
+
6596
+ ```typescript
6597
+ stringify(parse('2.0.0-alpha.1'))
6598
+ // => '2.0.0-alpha.1'
6599
+
6600
+ stringify(parse('1.0.0-beta+exp.sha.5114f85'))
6601
+ // => '1.0.0-beta+exp.sha.5114f85'
6602
+ ```
6603
+
6604
+ ---
6605
+
6235
6606
  ### `stripV`
6236
6607
 
6237
6608
  Strip the leading "v" from a version string if it exists.
package/meta/build.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
- "buildDate": "2026-04-19T20:44:59.079Z",
3
- "version": "2.0.0-alpha.17",
2
+ "buildDate": "2026-04-25T20:00:39.683Z",
3
+ "version": "2.0.0-alpha.19",
4
+ "mutationDashboardUrl": "https://dashboard.stryker-mutator.io/reports/github.com/helpers4/typescript/v2.0.0-alpha.19",
5
+ "runtimes": {
6
+ "node": ">=24.0.0",
7
+ "deno": "compatible",
8
+ "bun": "compatible",
9
+ "browser": "ES2022+"
10
+ },
4
11
  "categories": [
5
12
  "array",
6
13
  "date",
@@ -1,15 +1,15 @@
1
1
  {
2
- "@helpers4/all": "2.0.0-alpha.17",
3
- "@helpers4/array": "2.0.0-alpha.17",
4
- "@helpers4/date": "2.0.0-alpha.17",
5
- "@helpers4/function": "2.0.0-alpha.17",
6
- "@helpers4/math": "2.0.0-alpha.17",
7
- "@helpers4/number": "2.0.0-alpha.17",
8
- "@helpers4/object": "2.0.0-alpha.17",
9
- "@helpers4/observable": "2.0.0-alpha.17",
10
- "@helpers4/promise": "2.0.0-alpha.17",
11
- "@helpers4/string": "2.0.0-alpha.17",
12
- "@helpers4/type": "2.0.0-alpha.17",
13
- "@helpers4/url": "2.0.0-alpha.17",
14
- "@helpers4/version": "2.0.0-alpha.17"
2
+ "@helpers4/all": "2.0.0-alpha.19",
3
+ "@helpers4/array": "2.0.0-alpha.19",
4
+ "@helpers4/date": "2.0.0-alpha.19",
5
+ "@helpers4/function": "2.0.0-alpha.19",
6
+ "@helpers4/math": "2.0.0-alpha.19",
7
+ "@helpers4/number": "2.0.0-alpha.19",
8
+ "@helpers4/object": "2.0.0-alpha.19",
9
+ "@helpers4/observable": "2.0.0-alpha.19",
10
+ "@helpers4/promise": "2.0.0-alpha.19",
11
+ "@helpers4/string": "2.0.0-alpha.19",
12
+ "@helpers4/type": "2.0.0-alpha.19",
13
+ "@helpers4/url": "2.0.0-alpha.19",
14
+ "@helpers4/version": "2.0.0-alpha.19"
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpers4/all",
3
- "version": "2.0.0-alpha.17",
3
+ "version": "2.0.0-alpha.19",
4
4
  "description": "Complete collection of helpers4 utilities - all categories in one convenient package.",
5
5
  "author": "baxyz <baxy@etik.com>",
6
6
  "license": "LGPL-3.0",
@@ -27,17 +27,17 @@
27
27
  "llms.txt"
28
28
  ],
29
29
  "peerDependencies": {
30
- "@helpers4/array": "2.0.0-alpha.17",
31
- "@helpers4/date": "2.0.0-alpha.17",
32
- "@helpers4/function": "2.0.0-alpha.17",
33
- "@helpers4/math": "2.0.0-alpha.17",
34
- "@helpers4/number": "2.0.0-alpha.17",
35
- "@helpers4/object": "2.0.0-alpha.17",
36
- "@helpers4/observable": "2.0.0-alpha.17",
37
- "@helpers4/promise": "2.0.0-alpha.17",
38
- "@helpers4/string": "2.0.0-alpha.17",
39
- "@helpers4/type": "2.0.0-alpha.17",
40
- "@helpers4/url": "2.0.0-alpha.17",
41
- "@helpers4/version": "2.0.0-alpha.17"
30
+ "@helpers4/array": "2.0.0-alpha.19",
31
+ "@helpers4/date": "2.0.0-alpha.19",
32
+ "@helpers4/function": "2.0.0-alpha.19",
33
+ "@helpers4/math": "2.0.0-alpha.19",
34
+ "@helpers4/number": "2.0.0-alpha.19",
35
+ "@helpers4/object": "2.0.0-alpha.19",
36
+ "@helpers4/observable": "2.0.0-alpha.19",
37
+ "@helpers4/promise": "2.0.0-alpha.19",
38
+ "@helpers4/string": "2.0.0-alpha.19",
39
+ "@helpers4/type": "2.0.0-alpha.19",
40
+ "@helpers4/url": "2.0.0-alpha.19",
41
+ "@helpers4/version": "2.0.0-alpha.19"
42
42
  }
43
43
  }