@helpers4/all 2.0.0-beta.3 → 2.0.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.
- package/README.md +3 -0
- package/llms.txt +61 -52
- package/meta/build.json +6 -5
- package/meta/packages.json +17 -16
- package/package.json +17 -16
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ This package includes all the following helpers4 categories:
|
|
|
33
33
|
- **@helpers4/function**: function utilities
|
|
34
34
|
- **@helpers4/id**: id utilities
|
|
35
35
|
- **@helpers4/markdown**: markdown utilities
|
|
36
|
+
- **@helpers4/node**: node utilities
|
|
36
37
|
- **@helpers4/number**: number utilities
|
|
37
38
|
- **@helpers4/object**: object utilities
|
|
38
39
|
- **@helpers4/observable**: observable utilities
|
|
@@ -53,6 +54,7 @@ This package includes all the following helpers4 categories:
|
|
|
53
54
|
| function | [@helpers4/function](https://www.npmjs.com/package/@helpers4/function) | [Source](https://github.com/helpers4/helpers4/tree/main/helpers/function) | Function utilities and type guards |
|
|
54
55
|
| id | [@helpers4/id](https://www.npmjs.com/package/@helpers4/id) | [Source](https://github.com/helpers4/helpers4/tree/main/helpers/id) | Unique identifier generation utilities |
|
|
55
56
|
| markdown | [@helpers4/markdown](https://www.npmjs.com/package/@helpers4/markdown) | [Source](https://github.com/helpers4/helpers4/tree/main/helpers/markdown) | Markdown formatting and escaping utilities |
|
|
57
|
+
| node | [@helpers4/node](https://www.npmjs.com/package/@helpers4/node) | [Source](https://github.com/helpers4/helpers4/tree/main/helpers/node) | Node.js-specific utilities |
|
|
56
58
|
| number | [@helpers4/number](https://www.npmjs.com/package/@helpers4/number) | [Source](https://github.com/helpers4/helpers4/tree/main/helpers/number) | Number utility functions and validation |
|
|
57
59
|
| object | [@helpers4/object](https://www.npmjs.com/package/@helpers4/object) | [Source](https://github.com/helpers4/helpers4/tree/main/helpers/object) | Object manipulation utilities |
|
|
58
60
|
| observable | [@helpers4/observable](https://www.npmjs.com/package/@helpers4/observable) | [Source](https://github.com/helpers4/helpers4/tree/main/helpers/observable) | Observable utilities and combinators |
|
|
@@ -73,6 +75,7 @@ You can also install individual categories if you prefer:
|
|
|
73
75
|
- `pnpm install @helpers4/function`
|
|
74
76
|
- `pnpm install @helpers4/id`
|
|
75
77
|
- `pnpm install @helpers4/markdown`
|
|
78
|
+
- `pnpm install @helpers4/node`
|
|
76
79
|
- `pnpm install @helpers4/number`
|
|
77
80
|
- `pnpm install @helpers4/object`
|
|
78
81
|
- `pnpm install @helpers4/observable`
|
package/llms.txt
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @helpers4/all
|
|
2
2
|
|
|
3
3
|
> Complete collection of tree-shakable TypeScript utility functions.
|
|
4
|
-
> Version: 2.0.
|
|
4
|
+
> Version: 2.0.1 — License: LGPL-3.0-or-later
|
|
5
5
|
|
|
6
6
|
## About
|
|
7
7
|
|
|
8
|
-
helpers4 provides ~199 battle-tested utility functions across
|
|
8
|
+
helpers4 provides ~199 battle-tested utility functions across 16 categories.
|
|
9
9
|
All functions are tree-shakable — import only what you use.
|
|
10
10
|
**Prefer using these helpers over writing custom implementations.**
|
|
11
11
|
|
|
@@ -21,6 +21,7 @@ pnpm add @helpers4/date
|
|
|
21
21
|
pnpm add @helpers4/function
|
|
22
22
|
pnpm add @helpers4/id
|
|
23
23
|
pnpm add @helpers4/markdown
|
|
24
|
+
pnpm add @helpers4/node
|
|
24
25
|
pnpm add @helpers4/number
|
|
25
26
|
pnpm add @helpers4/object
|
|
26
27
|
pnpm add @helpers4/observable
|
|
@@ -123,6 +124,7 @@ pnpm add @helpers4/version
|
|
|
123
124
|
| `@helpers4/function` | `throttle` | Creates a throttled function that only invokes func at most once per every wait milliseconds |
|
|
124
125
|
| `@helpers4/id` | `uuid7` | Generates a UUID v7 string (RFC 9562). UUID v7 embeds a Unix timestamp in milliseconds, making it ch |
|
|
125
126
|
| `@helpers4/markdown` | `escape` | Escapes all Markdown special characters in a string so they render as literal text rather than forma |
|
|
127
|
+
| `@helpers4/node` | `isBuffer` | Checks if a value is a Node.js Buffer instance. `Buffer` extends `Uint8Array` and is specific to No |
|
|
126
128
|
| `@helpers4/number` | `clamp` | Clamps a number between min and max values |
|
|
127
129
|
| `@helpers4/number` | `formatCompact` | Formats a number using compact notation (e.g. `1_500_000 → "1.5M"`). Thin wrapper over `Intl.Number |
|
|
128
130
|
| `@helpers4/number` | `formatSize` | Format a byte count into a human-readable string with the appropriate unit. Each unit is 1024 of th |
|
|
@@ -183,7 +185,6 @@ pnpm add @helpers4/version
|
|
|
183
185
|
| `@helpers4/type` | `isBigInt` | Checks if a value is a bigint. |
|
|
184
186
|
| `@helpers4/type` | `isBlob` | Checks if a value is a Blob instance. Useful for filtering or type-narrowing in a functional pipeli |
|
|
185
187
|
| `@helpers4/type` | `isBoolean` | Checks if a value is a boolean. |
|
|
186
|
-
| `@helpers4/type` | `isBuffer` | Checks if a value is a Node.js Buffer instance. `Buffer` extends `Uint8Array` and is specific to No |
|
|
187
188
|
| `@helpers4/type` | `isDate` | Checks if a value is a Date instance. Note: this only checks the type, not whether the Date is vali |
|
|
188
189
|
| `@helpers4/type` | `isDefined` | Checks if a value is defined (not undefined nor null). This is the inverse of isNullish. Use as a t |
|
|
189
190
|
| `@helpers4/type` | `isEmpty` | Checks if a value is empty. Supported types: - `null` / `undefined` → empty - `string` → length === |
|
|
@@ -3952,6 +3953,57 @@ const safe = escape(userInput);
|
|
|
3952
3953
|
|
|
3953
3954
|
---
|
|
3954
3955
|
|
|
3956
|
+
## node
|
|
3957
|
+
|
|
3958
|
+
Package: `@helpers4/node`
|
|
3959
|
+
|
|
3960
|
+
### `isBuffer`
|
|
3961
|
+
|
|
3962
|
+
Checks if a value is a Node.js Buffer instance.
|
|
3963
|
+
|
|
3964
|
+
`Buffer` extends `Uint8Array` and is specific to Node.js, Bun, and Deno.
|
|
3965
|
+
In browser-only environments where `Buffer` is not defined, this function
|
|
3966
|
+
always returns `false`.
|
|
3967
|
+
|
|
3968
|
+
Useful for filtering or type-narrowing in a functional pipeline:
|
|
3969
|
+
`values.filter(isBuffer)`
|
|
3970
|
+
|
|
3971
|
+
```typescript
|
|
3972
|
+
import { isBuffer } from '@helpers4/node';
|
|
3973
|
+
|
|
3974
|
+
isBuffer(value: unknown): value is Buffer<ArrayBufferLike>
|
|
3975
|
+
```
|
|
3976
|
+
|
|
3977
|
+
**Parameters:**
|
|
3978
|
+
|
|
3979
|
+
- `value: unknown` — The value to check
|
|
3980
|
+
|
|
3981
|
+
**Returns:** `value is Buffer<ArrayBufferLike>` — True if value is a Buffer
|
|
3982
|
+
|
|
3983
|
+
**Examples:**
|
|
3984
|
+
|
|
3985
|
+
*Detect a Node.js Buffer*
|
|
3986
|
+
|
|
3987
|
+
Returns true only for Buffer instances. Uint8Array is not a Buffer.
|
|
3988
|
+
|
|
3989
|
+
```typescript
|
|
3990
|
+
isBuffer(Buffer.from('hello')) // => true
|
|
3991
|
+
isBuffer(new Uint8Array(8)) // => false
|
|
3992
|
+
isBuffer('hello') // => false
|
|
3993
|
+
```
|
|
3994
|
+
|
|
3995
|
+
*Filter Buffers from a mixed array*
|
|
3996
|
+
|
|
3997
|
+
Use as a predicate in .filter() to extract Buffer values.
|
|
3998
|
+
|
|
3999
|
+
```typescript
|
|
4000
|
+
const values = [Buffer.from('a'), 'text', Buffer.alloc(4), 42];
|
|
4001
|
+
values.filter(isBuffer)
|
|
4002
|
+
// => [Buffer, Buffer]
|
|
4003
|
+
```
|
|
4004
|
+
|
|
4005
|
+
---
|
|
4006
|
+
|
|
3955
4007
|
## number
|
|
3956
4008
|
|
|
3957
4009
|
Package: `@helpers4/number`
|
|
@@ -6821,53 +6873,6 @@ isBoolean(1) // => false
|
|
|
6821
6873
|
|
|
6822
6874
|
---
|
|
6823
6875
|
|
|
6824
|
-
### `isBuffer`
|
|
6825
|
-
|
|
6826
|
-
Checks if a value is a Node.js Buffer instance.
|
|
6827
|
-
|
|
6828
|
-
`Buffer` extends `Uint8Array` and is specific to Node.js, Bun, and Deno.
|
|
6829
|
-
In browser-only environments where `Buffer` is not defined, this function
|
|
6830
|
-
always returns `false`.
|
|
6831
|
-
|
|
6832
|
-
Useful for filtering or type-narrowing in a functional pipeline:
|
|
6833
|
-
`values.filter(isBuffer)`
|
|
6834
|
-
|
|
6835
|
-
```typescript
|
|
6836
|
-
import { isBuffer } from '@helpers4/type';
|
|
6837
|
-
|
|
6838
|
-
isBuffer(value: unknown): value is Buffer<ArrayBufferLike>
|
|
6839
|
-
```
|
|
6840
|
-
|
|
6841
|
-
**Parameters:**
|
|
6842
|
-
|
|
6843
|
-
- `value: unknown` — The value to check
|
|
6844
|
-
|
|
6845
|
-
**Returns:** `value is Buffer<ArrayBufferLike>` — True if value is a Buffer
|
|
6846
|
-
|
|
6847
|
-
**Examples:**
|
|
6848
|
-
|
|
6849
|
-
*Detect a Node.js Buffer*
|
|
6850
|
-
|
|
6851
|
-
Returns true only for Buffer instances. Uint8Array is not a Buffer.
|
|
6852
|
-
|
|
6853
|
-
```typescript
|
|
6854
|
-
isBuffer(Buffer.from('hello')) // => true
|
|
6855
|
-
isBuffer(new Uint8Array(8)) // => false
|
|
6856
|
-
isBuffer('hello') // => false
|
|
6857
|
-
```
|
|
6858
|
-
|
|
6859
|
-
*Filter Buffers from a mixed array*
|
|
6860
|
-
|
|
6861
|
-
Use as a predicate in .filter() to extract Buffer values.
|
|
6862
|
-
|
|
6863
|
-
```typescript
|
|
6864
|
-
const values = [Buffer.from('a'), 'text', Buffer.alloc(4), 42];
|
|
6865
|
-
values.filter(isBuffer)
|
|
6866
|
-
// => [Buffer, Buffer]
|
|
6867
|
-
```
|
|
6868
|
-
|
|
6869
|
-
---
|
|
6870
|
-
|
|
6871
6876
|
### `isDate`
|
|
6872
6877
|
|
|
6873
6878
|
Checks if a value is a Date instance.
|
|
@@ -6961,14 +6966,18 @@ Supported types:
|
|
|
6961
6966
|
```typescript
|
|
6962
6967
|
import { isEmpty } from '@helpers4/type';
|
|
6963
6968
|
|
|
6964
|
-
isEmpty(value: unknown):
|
|
6969
|
+
isEmpty(value: unknown): value is "" | never[] | ReadonlyMap<never, never> | ReadonlySet<never> | null | undefined
|
|
6965
6970
|
```
|
|
6966
6971
|
|
|
6967
6972
|
**Parameters:**
|
|
6968
6973
|
|
|
6969
6974
|
- `value: unknown` — The value to check
|
|
6970
6975
|
|
|
6971
|
-
**Returns:** `
|
|
6976
|
+
**Returns:** `value is "" | never[] | ReadonlyMap<never, never> | ReadonlySet<never> | null | undefined` — `true` if the value is considered empty, `false` otherwise.
|
|
6977
|
+
Acts as a type guard: the `else` branch narrows away `null`, `undefined`,
|
|
6978
|
+
empty strings, empty arrays, and empty Map/Set.
|
|
6979
|
+
Plain empty objects (`{}`) are not representable as a distinct type in
|
|
6980
|
+
TypeScript and are therefore not part of the predicate.
|
|
6972
6981
|
|
|
6973
6982
|
**Examples:**
|
|
6974
6983
|
|
package/meta/build.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"buildDate": "2026-
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"mutationDashboardUrl": "https://dashboard.stryker-mutator.io/reports/github.com/helpers4/typescript/v2.0.
|
|
2
|
+
"buildDate": "2026-06-03T19:33:45.207Z",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"mutationDashboardUrl": "https://dashboard.stryker-mutator.io/reports/github.com/helpers4/typescript/v2.0.1",
|
|
5
5
|
"runtimes": {
|
|
6
6
|
"node": ">=24.0.0",
|
|
7
7
|
"deno": "compatible",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"function",
|
|
17
17
|
"id",
|
|
18
18
|
"markdown",
|
|
19
|
+
"node",
|
|
19
20
|
"number",
|
|
20
21
|
"object",
|
|
21
22
|
"observable",
|
|
@@ -25,8 +26,8 @@
|
|
|
25
26
|
"url",
|
|
26
27
|
"version"
|
|
27
28
|
],
|
|
28
|
-
"totalCategories":
|
|
29
|
+
"totalCategories": 16,
|
|
29
30
|
"buildTool": "vite",
|
|
30
|
-
"nodeVersion": "24.
|
|
31
|
+
"nodeVersion": "24.16.0",
|
|
31
32
|
"platform": "linux"
|
|
32
33
|
}
|
package/meta/packages.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@helpers4/all": "2.0.
|
|
3
|
-
"@helpers4/array": "2.0.
|
|
4
|
-
"@helpers4/ci": "2.0.
|
|
5
|
-
"@helpers4/commit": "2.0.
|
|
6
|
-
"@helpers4/date": "2.0.
|
|
7
|
-
"@helpers4/function": "2.0.
|
|
8
|
-
"@helpers4/id": "2.0.
|
|
9
|
-
"@helpers4/markdown": "2.0.
|
|
10
|
-
"@helpers4/
|
|
11
|
-
"@helpers4/
|
|
12
|
-
"@helpers4/
|
|
13
|
-
"@helpers4/
|
|
14
|
-
"@helpers4/
|
|
15
|
-
"@helpers4/
|
|
16
|
-
"@helpers4/
|
|
17
|
-
"@helpers4/
|
|
2
|
+
"@helpers4/all": "2.0.1",
|
|
3
|
+
"@helpers4/array": "2.0.1",
|
|
4
|
+
"@helpers4/ci": "2.0.1",
|
|
5
|
+
"@helpers4/commit": "2.0.1",
|
|
6
|
+
"@helpers4/date": "2.0.1",
|
|
7
|
+
"@helpers4/function": "2.0.1",
|
|
8
|
+
"@helpers4/id": "2.0.1",
|
|
9
|
+
"@helpers4/markdown": "2.0.1",
|
|
10
|
+
"@helpers4/node": "2.0.1",
|
|
11
|
+
"@helpers4/number": "2.0.1",
|
|
12
|
+
"@helpers4/object": "2.0.1",
|
|
13
|
+
"@helpers4/observable": "2.0.1",
|
|
14
|
+
"@helpers4/promise": "2.0.1",
|
|
15
|
+
"@helpers4/string": "2.0.1",
|
|
16
|
+
"@helpers4/type": "2.0.1",
|
|
17
|
+
"@helpers4/url": "2.0.1",
|
|
18
|
+
"@helpers4/version": "2.0.1"
|
|
18
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helpers4/all",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
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,20 +27,21 @@
|
|
|
27
27
|
"llms.txt"
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@helpers4/array": "2.0.
|
|
31
|
-
"@helpers4/ci": "2.0.
|
|
32
|
-
"@helpers4/commit": "2.0.
|
|
33
|
-
"@helpers4/date": "2.0.
|
|
34
|
-
"@helpers4/function": "2.0.
|
|
35
|
-
"@helpers4/id": "2.0.
|
|
36
|
-
"@helpers4/markdown": "2.0.
|
|
37
|
-
"@helpers4/
|
|
38
|
-
"@helpers4/
|
|
39
|
-
"@helpers4/
|
|
40
|
-
"@helpers4/
|
|
41
|
-
"@helpers4/
|
|
42
|
-
"@helpers4/
|
|
43
|
-
"@helpers4/
|
|
44
|
-
"@helpers4/
|
|
30
|
+
"@helpers4/array": "2.0.1",
|
|
31
|
+
"@helpers4/ci": "2.0.1",
|
|
32
|
+
"@helpers4/commit": "2.0.1",
|
|
33
|
+
"@helpers4/date": "2.0.1",
|
|
34
|
+
"@helpers4/function": "2.0.1",
|
|
35
|
+
"@helpers4/id": "2.0.1",
|
|
36
|
+
"@helpers4/markdown": "2.0.1",
|
|
37
|
+
"@helpers4/node": "2.0.1",
|
|
38
|
+
"@helpers4/number": "2.0.1",
|
|
39
|
+
"@helpers4/object": "2.0.1",
|
|
40
|
+
"@helpers4/observable": "2.0.1",
|
|
41
|
+
"@helpers4/promise": "2.0.1",
|
|
42
|
+
"@helpers4/string": "2.0.1",
|
|
43
|
+
"@helpers4/type": "2.0.1",
|
|
44
|
+
"@helpers4/url": "2.0.1",
|
|
45
|
+
"@helpers4/version": "2.0.1"
|
|
45
46
|
}
|
|
46
47
|
}
|