@socketsecurity/lib 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/arrays.d.ts +143 -0
- package/dist/arrays.js.map +2 -2
- package/dist/fs.d.ts +595 -23
- package/dist/fs.js.map +2 -2
- package/dist/git.d.ts +488 -41
- package/dist/git.js.map +2 -2
- package/dist/github.d.ts +361 -12
- package/dist/github.js.map +2 -2
- package/dist/http-request.d.ts +463 -4
- package/dist/http-request.js.map +2 -2
- package/dist/json.d.ts +177 -4
- package/dist/json.js.map +2 -2
- package/dist/logger.d.ts +822 -67
- package/dist/logger.js +653 -46
- package/dist/logger.js.map +2 -2
- package/dist/objects.d.ts +386 -10
- package/dist/objects.js.map +2 -2
- package/dist/path.d.ts +270 -6
- package/dist/path.js.map +2 -2
- package/dist/promises.d.ts +432 -27
- package/dist/promises.js.map +2 -2
- package/dist/spawn.d.ts +239 -12
- package/dist/spawn.js.map +2 -2
- package/dist/spinner.d.ts +260 -20
- package/dist/spinner.js +201 -63
- package/dist/spinner.js.map +2 -2
- package/dist/stdio/clear.d.ts +130 -9
- package/dist/stdio/clear.js.map +2 -2
- package/dist/stdio/divider.d.ts +106 -10
- package/dist/stdio/divider.js +10 -0
- package/dist/stdio/divider.js.map +2 -2
- package/dist/stdio/footer.d.ts +70 -3
- package/dist/stdio/footer.js.map +2 -2
- package/dist/stdio/header.d.ts +93 -12
- package/dist/stdio/header.js.map +2 -2
- package/dist/stdio/mask.d.ts +82 -14
- package/dist/stdio/mask.js +25 -4
- package/dist/stdio/mask.js.map +2 -2
- package/dist/stdio/progress.d.ts +112 -15
- package/dist/stdio/progress.js +43 -3
- package/dist/stdio/progress.js.map +2 -2
- package/dist/stdio/prompts.d.ts +95 -5
- package/dist/stdio/prompts.js.map +2 -2
- package/dist/stdio/stderr.d.ts +114 -11
- package/dist/stdio/stderr.js.map +2 -2
- package/dist/stdio/stdout.d.ts +107 -11
- package/dist/stdio/stdout.js.map +2 -2
- package/dist/strings.d.ts +357 -28
- package/dist/strings.js.map +2 -2
- package/dist/validation/json-parser.d.ts +226 -7
- package/dist/validation/json-parser.js.map +2 -2
- package/dist/validation/types.d.ts +114 -8
- package/dist/validation/types.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.0] - 2025-10-23
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added `filterOutput` option to `stdio/mask` for filtering output chunks before display/buffering
|
|
13
|
+
- Added `overrideExitCode` option to `stdio/mask` for customizing exit codes based on captured output
|
|
14
|
+
- Added comprehensive JSDoc documentation across entire library for enhanced VSCode IntelliSense
|
|
15
|
+
- Detailed @param, @returns, @template, @throws tags
|
|
16
|
+
- Practical @example blocks with real-world usage patterns
|
|
17
|
+
- @default tags showing default values
|
|
18
|
+
- Enhanced interface property documentation
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Improved TypeScript type hints and tooltips throughout library
|
|
23
|
+
- Enhanced documentation for all core utilities (arrays, fs, git, github, http-request, json, logger, objects, path, promises, spawn, spinner, strings)
|
|
24
|
+
- Enhanced documentation for stdio utilities (clear, divider, footer, header, mask, progress, prompts, stderr, stdout)
|
|
25
|
+
- Enhanced documentation for validation utilities (json-parser, types)
|
|
26
|
+
|
|
8
27
|
## [1.0.5] - 2025-10-22
|
|
9
28
|
|
|
10
29
|
### Added
|
package/dist/arrays.d.ts
CHANGED
|
@@ -1,10 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Split an array into chunks of a specified size.
|
|
3
|
+
*
|
|
4
|
+
* Divides an array into smaller arrays of the specified chunk size.
|
|
5
|
+
* The last chunk may contain fewer elements if the array length is not
|
|
6
|
+
* evenly divisible by the chunk size.
|
|
7
|
+
*
|
|
8
|
+
* @param arr - The array to split into chunks (can be readonly)
|
|
9
|
+
* @param size - Size of each chunk. Must be greater than 0.
|
|
10
|
+
* @default 2
|
|
11
|
+
* @returns Array of chunks, where each chunk is an array of elements
|
|
12
|
+
* @throws {Error} If chunk size is less than or equal to 0
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // Split into pairs (default)
|
|
17
|
+
* arrayChunk([1, 2, 3, 4, 5])
|
|
18
|
+
* // Returns: [[1, 2], [3, 4], [5]]
|
|
19
|
+
*
|
|
20
|
+
* // Split into groups of 3
|
|
21
|
+
* arrayChunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3)
|
|
22
|
+
* // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]
|
|
23
|
+
*
|
|
24
|
+
* // Works with readonly arrays
|
|
25
|
+
* const readonlyArr = [1, 2, 3] as const
|
|
26
|
+
* arrayChunk(readonlyArr)
|
|
27
|
+
* // Returns: [[1, 2], [3]]
|
|
28
|
+
* ```
|
|
3
29
|
*/
|
|
4
30
|
/*@__NO_SIDE_EFFECTS__*/
|
|
5
31
|
export declare function arrayChunk<T>(arr: T[] | readonly T[], size?: number | undefined): T[][];
|
|
6
32
|
/**
|
|
7
33
|
* Get unique values from an array.
|
|
34
|
+
*
|
|
35
|
+
* Returns a new array containing only the unique values from the input array.
|
|
36
|
+
* Uses `Set` internally for efficient deduplication. Order of first occurrence
|
|
37
|
+
* is preserved.
|
|
38
|
+
*
|
|
39
|
+
* @param arr - The array to deduplicate (can be readonly)
|
|
40
|
+
* @returns New array with duplicate values removed
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* // Remove duplicate numbers
|
|
45
|
+
* arrayUnique([1, 2, 2, 3, 1, 4])
|
|
46
|
+
* // Returns: [1, 2, 3, 4]
|
|
47
|
+
*
|
|
48
|
+
* // Remove duplicate strings
|
|
49
|
+
* arrayUnique(['apple', 'banana', 'apple', 'cherry'])
|
|
50
|
+
* // Returns: ['apple', 'banana', 'cherry']
|
|
51
|
+
*
|
|
52
|
+
* // Works with readonly arrays
|
|
53
|
+
* const readonlyArr = [1, 1, 2] as const
|
|
54
|
+
* arrayUnique(readonlyArr)
|
|
55
|
+
* // Returns: [1, 2]
|
|
56
|
+
*
|
|
57
|
+
* // Empty arrays return empty
|
|
58
|
+
* arrayUnique([])
|
|
59
|
+
* // Returns: []
|
|
60
|
+
* ```
|
|
8
61
|
*/
|
|
9
62
|
/*@__NO_SIDE_EFFECTS__*/
|
|
10
63
|
export declare function arrayUnique<T>(arr: T[] | readonly T[]): T[];
|
|
@@ -15,15 +68,105 @@ export declare function arrayUnique<T>(arr: T[] | readonly T[]): T[];
|
|
|
15
68
|
/**
|
|
16
69
|
* Alias for native Array.isArray.
|
|
17
70
|
* Determines whether the passed value is an array.
|
|
71
|
+
*
|
|
72
|
+
* This is a direct reference to the native `Array.isArray` method,
|
|
73
|
+
* providing a type guard that narrows the type to an array type.
|
|
74
|
+
* Exported for consistency with other array utilities in this module.
|
|
75
|
+
*
|
|
76
|
+
* @param value - The value to check
|
|
77
|
+
* @returns `true` if the value is an array, `false` otherwise
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* // Check if value is an array
|
|
82
|
+
* isArray([1, 2, 3])
|
|
83
|
+
* // Returns: true
|
|
84
|
+
*
|
|
85
|
+
* isArray('not an array')
|
|
86
|
+
* // Returns: false
|
|
87
|
+
*
|
|
88
|
+
* isArray(null)
|
|
89
|
+
* // Returns: false
|
|
90
|
+
*
|
|
91
|
+
* // Type guard usage
|
|
92
|
+
* function processValue(value: unknown) {
|
|
93
|
+
* if (isArray(value)) {
|
|
94
|
+
* // TypeScript knows value is an array here
|
|
95
|
+
* console.log(value.length)
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
18
99
|
*/
|
|
19
100
|
export declare const isArray: (arg: any) => arg is any[];
|
|
20
101
|
/**
|
|
21
102
|
* Join array elements with proper "and" conjunction formatting.
|
|
103
|
+
*
|
|
104
|
+
* Formats an array of strings into a grammatically correct list using
|
|
105
|
+
* "and" as the conjunction. Uses `Intl.ListFormat` for proper English
|
|
106
|
+
* formatting with Oxford comma support.
|
|
107
|
+
*
|
|
108
|
+
* @param arr - Array of strings to join (can be readonly)
|
|
109
|
+
* @returns Formatted string with proper "and" conjunction
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* // Two items
|
|
114
|
+
* joinAnd(['apples', 'oranges'])
|
|
115
|
+
* // Returns: "apples and oranges"
|
|
116
|
+
*
|
|
117
|
+
* // Three or more items (Oxford comma)
|
|
118
|
+
* joinAnd(['apples', 'oranges', 'bananas'])
|
|
119
|
+
* // Returns: "apples, oranges, and bananas"
|
|
120
|
+
*
|
|
121
|
+
* // Single item
|
|
122
|
+
* joinAnd(['apples'])
|
|
123
|
+
* // Returns: "apples"
|
|
124
|
+
*
|
|
125
|
+
* // Empty array
|
|
126
|
+
* joinAnd([])
|
|
127
|
+
* // Returns: ""
|
|
128
|
+
*
|
|
129
|
+
* // Usage in messages
|
|
130
|
+
* const items = ['React', 'Vue', 'Angular']
|
|
131
|
+
* console.log(`You can choose ${joinAnd(items)}`)
|
|
132
|
+
* // Outputs: "You can choose React, Vue, and Angular"
|
|
133
|
+
* ```
|
|
22
134
|
*/
|
|
23
135
|
/*@__NO_SIDE_EFFECTS__*/
|
|
24
136
|
export declare function joinAnd(arr: string[] | readonly string[]): string;
|
|
25
137
|
/**
|
|
26
138
|
* Join array elements with proper "or" disjunction formatting.
|
|
139
|
+
*
|
|
140
|
+
* Formats an array of strings into a grammatically correct list using
|
|
141
|
+
* "or" as the disjunction. Uses `Intl.ListFormat` for proper English
|
|
142
|
+
* formatting with Oxford comma support.
|
|
143
|
+
*
|
|
144
|
+
* @param arr - Array of strings to join (can be readonly)
|
|
145
|
+
* @returns Formatted string with proper "or" disjunction
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* // Two items
|
|
150
|
+
* joinOr(['yes', 'no'])
|
|
151
|
+
* // Returns: "yes or no"
|
|
152
|
+
*
|
|
153
|
+
* // Three or more items (Oxford comma)
|
|
154
|
+
* joinOr(['red', 'green', 'blue'])
|
|
155
|
+
* // Returns: "red, green, or blue"
|
|
156
|
+
*
|
|
157
|
+
* // Single item
|
|
158
|
+
* joinOr(['maybe'])
|
|
159
|
+
* // Returns: "maybe"
|
|
160
|
+
*
|
|
161
|
+
* // Empty array
|
|
162
|
+
* joinOr([])
|
|
163
|
+
* // Returns: ""
|
|
164
|
+
*
|
|
165
|
+
* // Usage in prompts
|
|
166
|
+
* const options = ['npm', 'yarn', 'pnpm']
|
|
167
|
+
* console.log(`Choose a package manager: ${joinOr(options)}`)
|
|
168
|
+
* // Outputs: "Choose a package manager: npm, yarn, or pnpm"
|
|
169
|
+
* ```
|
|
27
170
|
*/
|
|
28
171
|
/*@__NO_SIDE_EFFECTS__*/
|
|
29
172
|
export declare function joinOr(arr: string[] | readonly string[]): string;
|
package/dist/arrays.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/arrays.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview Array utility functions for formatting lists and collections.\n * Provides conjunction and disjunction formatters using Intl.ListFormat.\n */\n\nlet _conjunctionFormatter: Intl.ListFormat | undefined\n/**\n * Get a cached Intl.ListFormat instance for conjunction (and) formatting.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getConjunctionFormatter() {\n if (_conjunctionFormatter === undefined) {\n _conjunctionFormatter = new Intl.ListFormat('en', {\n style: 'long',\n // \"and\" lists.\n type: 'conjunction',\n })\n }\n return _conjunctionFormatter\n}\n\nlet _disjunctionFormatter: Intl.ListFormat | undefined\n/**\n * Get a cached Intl.ListFormat instance for disjunction (or) formatting.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getDisjunctionFormatter() {\n if (_disjunctionFormatter === undefined) {\n _disjunctionFormatter = new Intl.ListFormat('en', {\n style: 'long',\n // \"or\" lists.\n type: 'disjunction',\n })\n }\n return _disjunctionFormatter\n}\n\n/**\n * Split an array into chunks of a specified size.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function arrayChunk<T>(\n arr: T[] | readonly T[],\n size?: number | undefined,\n): T[][] {\n const chunkSize = size ?? 2\n if (chunkSize <= 0) {\n throw new Error('Chunk size must be greater than 0')\n }\n const { length } = arr\n const actualChunkSize = Math.min(length, chunkSize)\n const chunks = []\n for (let i = 0; i < length; i += actualChunkSize) {\n chunks.push(arr.slice(i, i + actualChunkSize) as T[])\n }\n return chunks\n}\n\n/**\n * Get unique values from an array.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function arrayUnique<T>(arr: T[] | readonly T[]): T[] {\n return [...new Set(arr)]\n}\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\n\n/**\n * Alias for native Array.isArray.\n * Determines whether the passed value is an array.\n */\nexport const isArray = Array.isArray\n\n/**\n * Join array elements with proper \"and\" conjunction formatting.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function joinAnd(arr: string[] | readonly string[]): string {\n return getConjunctionFormatter().format(arr)\n}\n\n/**\n * Join array elements with proper \"or\" disjunction formatting.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function joinOr(arr: string[] | readonly string[]): string {\n return getDisjunctionFormatter().format(arr)\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAI;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Array utility functions for formatting lists and collections.\n * Provides conjunction and disjunction formatters using Intl.ListFormat.\n */\n\nlet _conjunctionFormatter: Intl.ListFormat | undefined\n/**\n * Get a cached Intl.ListFormat instance for conjunction (and) formatting.\n *\n * Creates a singleton formatter for English \"and\" lists using the long style.\n * The formatter is lazily initialized on first use and reused for performance.\n *\n * @returns Cached Intl.ListFormat instance configured for conjunction formatting\n *\n * @example\n * ```ts\n * const formatter = getConjunctionFormatter()\n * formatter.format(['apple', 'banana', 'cherry'])\n * // Returns: \"apple, banana, and cherry\"\n * ```\n *\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getConjunctionFormatter() {\n if (_conjunctionFormatter === undefined) {\n _conjunctionFormatter = new Intl.ListFormat('en', {\n style: 'long',\n // \"and\" lists.\n type: 'conjunction',\n })\n }\n return _conjunctionFormatter\n}\n\nlet _disjunctionFormatter: Intl.ListFormat | undefined\n/**\n * Get a cached Intl.ListFormat instance for disjunction (or) formatting.\n *\n * Creates a singleton formatter for English \"or\" lists using the long style.\n * The formatter is lazily initialized on first use and reused for performance.\n *\n * @returns Cached Intl.ListFormat instance configured for disjunction formatting\n *\n * @example\n * ```ts\n * const formatter = getDisjunctionFormatter()\n * formatter.format(['red', 'blue', 'green'])\n * // Returns: \"red, blue, or green\"\n * ```\n *\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getDisjunctionFormatter() {\n if (_disjunctionFormatter === undefined) {\n _disjunctionFormatter = new Intl.ListFormat('en', {\n style: 'long',\n // \"or\" lists.\n type: 'disjunction',\n })\n }\n return _disjunctionFormatter\n}\n\n/**\n * Split an array into chunks of a specified size.\n *\n * Divides an array into smaller arrays of the specified chunk size.\n * The last chunk may contain fewer elements if the array length is not\n * evenly divisible by the chunk size.\n *\n * @param arr - The array to split into chunks (can be readonly)\n * @param size - Size of each chunk. Must be greater than 0.\n * @default 2\n * @returns Array of chunks, where each chunk is an array of elements\n * @throws {Error} If chunk size is less than or equal to 0\n *\n * @example\n * ```ts\n * // Split into pairs (default)\n * arrayChunk([1, 2, 3, 4, 5])\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * // Split into groups of 3\n * arrayChunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3)\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n *\n * // Works with readonly arrays\n * const readonlyArr = [1, 2, 3] as const\n * arrayChunk(readonlyArr)\n * // Returns: [[1, 2], [3]]\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function arrayChunk<T>(\n arr: T[] | readonly T[],\n size?: number | undefined,\n): T[][] {\n const chunkSize = size ?? 2\n if (chunkSize <= 0) {\n throw new Error('Chunk size must be greater than 0')\n }\n const { length } = arr\n const actualChunkSize = Math.min(length, chunkSize)\n const chunks = []\n for (let i = 0; i < length; i += actualChunkSize) {\n chunks.push(arr.slice(i, i + actualChunkSize) as T[])\n }\n return chunks\n}\n\n/**\n * Get unique values from an array.\n *\n * Returns a new array containing only the unique values from the input array.\n * Uses `Set` internally for efficient deduplication. Order of first occurrence\n * is preserved.\n *\n * @param arr - The array to deduplicate (can be readonly)\n * @returns New array with duplicate values removed\n *\n * @example\n * ```ts\n * // Remove duplicate numbers\n * arrayUnique([1, 2, 2, 3, 1, 4])\n * // Returns: [1, 2, 3, 4]\n *\n * // Remove duplicate strings\n * arrayUnique(['apple', 'banana', 'apple', 'cherry'])\n * // Returns: ['apple', 'banana', 'cherry']\n *\n * // Works with readonly arrays\n * const readonlyArr = [1, 1, 2] as const\n * arrayUnique(readonlyArr)\n * // Returns: [1, 2]\n *\n * // Empty arrays return empty\n * arrayUnique([])\n * // Returns: []\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function arrayUnique<T>(arr: T[] | readonly T[]): T[] {\n return [...new Set(arr)]\n}\n\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\n\n/**\n * Alias for native Array.isArray.\n * Determines whether the passed value is an array.\n *\n * This is a direct reference to the native `Array.isArray` method,\n * providing a type guard that narrows the type to an array type.\n * Exported for consistency with other array utilities in this module.\n *\n * @param value - The value to check\n * @returns `true` if the value is an array, `false` otherwise\n *\n * @example\n * ```ts\n * // Check if value is an array\n * isArray([1, 2, 3])\n * // Returns: true\n *\n * isArray('not an array')\n * // Returns: false\n *\n * isArray(null)\n * // Returns: false\n *\n * // Type guard usage\n * function processValue(value: unknown) {\n * if (isArray(value)) {\n * // TypeScript knows value is an array here\n * console.log(value.length)\n * }\n * }\n * ```\n */\nexport const isArray = Array.isArray\n\n/**\n * Join array elements with proper \"and\" conjunction formatting.\n *\n * Formats an array of strings into a grammatically correct list using\n * \"and\" as the conjunction. Uses `Intl.ListFormat` for proper English\n * formatting with Oxford comma support.\n *\n * @param arr - Array of strings to join (can be readonly)\n * @returns Formatted string with proper \"and\" conjunction\n *\n * @example\n * ```ts\n * // Two items\n * joinAnd(['apples', 'oranges'])\n * // Returns: \"apples and oranges\"\n *\n * // Three or more items (Oxford comma)\n * joinAnd(['apples', 'oranges', 'bananas'])\n * // Returns: \"apples, oranges, and bananas\"\n *\n * // Single item\n * joinAnd(['apples'])\n * // Returns: \"apples\"\n *\n * // Empty array\n * joinAnd([])\n * // Returns: \"\"\n *\n * // Usage in messages\n * const items = ['React', 'Vue', 'Angular']\n * console.log(`You can choose ${joinAnd(items)}`)\n * // Outputs: \"You can choose React, Vue, and Angular\"\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function joinAnd(arr: string[] | readonly string[]): string {\n return getConjunctionFormatter().format(arr)\n}\n\n/**\n * Join array elements with proper \"or\" disjunction formatting.\n *\n * Formats an array of strings into a grammatically correct list using\n * \"or\" as the disjunction. Uses `Intl.ListFormat` for proper English\n * formatting with Oxford comma support.\n *\n * @param arr - Array of strings to join (can be readonly)\n * @returns Formatted string with proper \"or\" disjunction\n *\n * @example\n * ```ts\n * // Two items\n * joinOr(['yes', 'no'])\n * // Returns: \"yes or no\"\n *\n * // Three or more items (Oxford comma)\n * joinOr(['red', 'green', 'blue'])\n * // Returns: \"red, green, or blue\"\n *\n * // Single item\n * joinOr(['maybe'])\n * // Returns: \"maybe\"\n *\n * // Empty array\n * joinOr([])\n * // Returns: \"\"\n *\n * // Usage in prompts\n * const options = ['npm', 'yarn', 'pnpm']\n * console.log(`Choose a package manager: ${joinOr(options)}`)\n * // Outputs: \"Choose a package manager: npm, yarn, or pnpm\"\n * ```\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function joinOr(arr: string[] | readonly string[]): string {\n return getDisjunctionFormatter().format(arr)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAI;AAAA;AAmBJ,SAAS,0BAA0B;AACjC,MAAI,0BAA0B,QAAW;AACvC,4BAAwB,IAAI,KAAK,WAAW,MAAM;AAAA,MAChD,OAAO;AAAA;AAAA,MAEP,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAEA,IAAI;AAAA;AAmBJ,SAAS,0BAA0B;AACjC,MAAI,0BAA0B,QAAW;AACvC,4BAAwB,IAAI,KAAK,WAAW,MAAM;AAAA,MAChD,OAAO;AAAA;AAAA,MAEP,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAAA;AAgCO,SAAS,WACd,KACA,MACO;AACP,QAAM,YAAY,QAAQ;AAC1B,MAAI,aAAa,GAAG;AAClB,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AACA,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,kBAAkB,KAAK,IAAI,QAAQ,SAAS;AAClD,QAAM,SAAS,CAAC;AAChB,WAAS,IAAI,GAAG,IAAI,QAAQ,KAAK,iBAAiB;AAChD,WAAO,KAAK,IAAI,MAAM,GAAG,IAAI,eAAe,CAAQ;AAAA,EACtD;AACA,SAAO;AACT;AAAA;AAiCO,SAAS,YAAe,KAA8B;AAC3D,SAAO,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC;AACzB;AAuCO,MAAM,UAAU,MAAM;AAAA;AAqCtB,SAAS,QAAQ,KAA2C;AACjE,UAAO,wCAAwB,GAAE,OAAO,GAAG;AAC7C;AAAA;AAqCO,SAAS,OAAO,KAA2C;AAChE,UAAO,wCAAwB,GAAE,OAAO,GAAG;AAC7C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|