@jackens/nnn 2025.12.9 → 2025.12.11
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/nnn.d.ts +390 -75
- package/nnn.js +30 -178
- package/package.json +1 -1
- package/readme.md +382 -103
package/nnn.d.ts
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Single argument type for the {@link h} and {@link s} helpers.
|
|
3
|
+
*/
|
|
2
4
|
export type HArgs1 = Record<PropertyKey, unknown> | null | undefined | Node | string | number | HArgs;
|
|
3
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Tuple argument type for the {@link h} and {@link s} helpers.
|
|
7
|
+
*/
|
|
4
8
|
export type HArgs = [string | Node, ...HArgs1[]];
|
|
5
9
|
/**
|
|
6
|
-
* A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper
|
|
10
|
+
* A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper
|
|
11
|
+
* for creating and modifying `HTMLElement`s (see also {@link s}).
|
|
12
|
+
*
|
|
13
|
+
* @param tag_or_node
|
|
14
|
+
*
|
|
15
|
+
* If a `string`, it is treated as the tag name for a new element.
|
|
16
|
+
* If a `Node`, that node is modified in place.
|
|
7
17
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - `null` / `undefined
|
|
15
|
-
* - `Node
|
|
16
|
-
* - `string` / `number
|
|
17
|
-
* -
|
|
18
|
+
* @param args
|
|
19
|
+
*
|
|
20
|
+
* Additional arguments processed as follows:
|
|
21
|
+
* - `Object`: Maps attributes/properties. Keys starting with `$` set element properties
|
|
22
|
+
* (without the `$` prefix); other keys set attributes via `setAttribute`.
|
|
23
|
+
* A value of `false` removes the attribute.
|
|
24
|
+
* - `null` / `undefined`: Ignored.
|
|
25
|
+
* - `Node`: Appended as a child.
|
|
26
|
+
* - `string` / `number`: Converted to a `Text` node and appended.
|
|
27
|
+
* - {@link HArgs} array: Processed recursively.
|
|
28
|
+
*
|
|
29
|
+
* @returns
|
|
30
|
+
*
|
|
31
|
+
* The created or modified `HTMLElement`.
|
|
18
32
|
*/
|
|
19
33
|
export declare const h: {
|
|
20
34
|
<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs1[]): HTMLElementTagNameMap[T];
|
|
@@ -22,117 +36,418 @@ export declare const h: {
|
|
|
22
36
|
(tag_or_node: string | Node, ...args1: HArgs1[]): Node;
|
|
23
37
|
};
|
|
24
38
|
/**
|
|
25
|
-
* A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper
|
|
39
|
+
* A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper
|
|
40
|
+
* for creating and modifying `SVGElement`s (see also {@link h}).
|
|
41
|
+
*
|
|
42
|
+
* @param tag_or_node
|
|
43
|
+
*
|
|
44
|
+
* If a `string`, it is treated as the tag name for a new element.
|
|
45
|
+
* If a `Node`, that node is modified in place.
|
|
26
46
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* - `null` / `undefined
|
|
34
|
-
* - `Node
|
|
35
|
-
* - `string` / `number
|
|
36
|
-
* -
|
|
47
|
+
* @param args
|
|
48
|
+
*
|
|
49
|
+
* Additional arguments processed as follows:
|
|
50
|
+
* - `Object`: Maps attributes/properties. Keys starting with `$` set element properties
|
|
51
|
+
* (without the `$` prefix); other keys set attributes via `setAttributeNS`.
|
|
52
|
+
* A value of `false` removes the attribute.
|
|
53
|
+
* - `null` / `undefined`: Ignored.
|
|
54
|
+
* - `Node`: Appended as a child.
|
|
55
|
+
* - `string` / `number`: Converted to a `Text` node and appended.
|
|
56
|
+
* - {@link HArgs} array: Processed recursively.
|
|
57
|
+
*
|
|
58
|
+
* @returns
|
|
59
|
+
*
|
|
60
|
+
* The created or modified `SVGElement`.
|
|
37
61
|
*/
|
|
38
62
|
export declare const s: {
|
|
39
63
|
<T extends keyof SVGElementTagNameMap>(tag: T, ...args1: HArgs1[]): SVGElementTagNameMap[T];
|
|
40
64
|
<N extends Node>(node: N, ...args1: HArgs1[]): N;
|
|
41
65
|
(tag_or_node: string | Node, ...args1: HArgs1[]): Node;
|
|
42
66
|
};
|
|
43
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Shorthand for creating an SVG element with a `<use>` child referencing an icon by ID.
|
|
69
|
+
*
|
|
70
|
+
* Equivalent to: `s('svg', ['use', { 'xlink:href': '#' + id }], ...args)`.
|
|
71
|
+
*
|
|
72
|
+
* @param id
|
|
73
|
+
*
|
|
74
|
+
* The ID of the symbol to reference (without the `#` prefix).
|
|
75
|
+
*
|
|
76
|
+
* @param args
|
|
77
|
+
*
|
|
78
|
+
* Additional arguments passed to the outer `<svg>` element.
|
|
79
|
+
*
|
|
80
|
+
* @returns
|
|
81
|
+
*
|
|
82
|
+
* An `SVGSVGElement` containing a `<use>` element.
|
|
83
|
+
*/
|
|
44
84
|
export declare const svg_use: (id: string, ...args: HArgs1[]) => SVGSVGElement;
|
|
45
85
|
/**
|
|
46
|
-
*
|
|
86
|
+
* A helper for building simple tokenizers (see also {@link nanolight_ts}).
|
|
87
|
+
*
|
|
88
|
+
* @param decorator
|
|
89
|
+
*
|
|
90
|
+
* A function that wraps each matched chunk. It receives the matched text (`chunk`)
|
|
91
|
+
* and optionally the `metadata` associated with the pattern that produced the match.
|
|
92
|
+
* For unmatched text between patterns, `metadata` is `undefined`.
|
|
93
|
+
*
|
|
94
|
+
* @param specs
|
|
95
|
+
*
|
|
96
|
+
* An array of tuples `[metadata, pattern]` where:
|
|
97
|
+
* - `metadata`: Arbitrary data (e.g., a CSS class name) passed to `decorator` when the pattern matches.
|
|
98
|
+
* - `pattern`: A `string` or `RegExp` to match against the input.
|
|
99
|
+
*
|
|
100
|
+
* @returns
|
|
101
|
+
*
|
|
102
|
+
* A tokenizer function that accepts a code string and returns an array of decorated tokens.
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
*
|
|
106
|
+
* 1. Matches starting at an earlier position take precedence.
|
|
107
|
+
* 2. Among matches at the same position, the longer one wins.
|
|
108
|
+
* 3. Among matches of the same position and length, the one defined earlier wins.
|
|
109
|
+
*/
|
|
110
|
+
export declare const new_tokenizer: <M, T>(decorator: (chunk: string, metadata?: M) => T, ...specs: [M, string | RegExp][]) => (code: string) => T[];
|
|
111
|
+
/**
|
|
112
|
+
* A TypeScript/JavaScript syntax highlighting tokenizer built using {@link new_tokenizer}.
|
|
47
113
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
114
|
+
* @param code
|
|
115
|
+
*
|
|
116
|
+
* The source code string to tokenize.
|
|
117
|
+
*
|
|
118
|
+
* @returns
|
|
119
|
+
*
|
|
120
|
+
* An array of {@link HArgs1} elements suitable for rendering with {@link h} or {@link s}.
|
|
54
121
|
*/
|
|
55
|
-
export declare const nanolight: <T>(decorator: (chunk: string, name?: string) => T, ...configs: Record<string, (string | RegExp)[]>[]) => (code: string) => T[];
|
|
56
|
-
/** TypeScript syntax highlighting helper (built on `nanolight`). */
|
|
57
122
|
export declare const nanolight_ts: (code: string) => HArgs1[];
|
|
58
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* Applies Polish-specific typographic corrections to a DOM subtree.
|
|
125
|
+
*
|
|
126
|
+
* This function prevents orphaned conjunctions (single-letter words like “a”, “i”, “o”, “u”, “w”, “z”)
|
|
127
|
+
* from appearing at the end of a line by wrapping them with the following word in a non-breaking span.
|
|
128
|
+
* It also inserts zero-width spaces after slashes and dots to allow line breaks.
|
|
129
|
+
*
|
|
130
|
+
* @param node
|
|
131
|
+
*
|
|
132
|
+
* The root DOM node to process. All descendant text nodes are corrected recursively,
|
|
133
|
+
* except those inside `IFRAME`, `NOSCRIPT`, `PRE`, `SCRIPT`, `STYLE`, or `TEXTAREA` elements.
|
|
134
|
+
*/
|
|
59
135
|
export declare const fix_typography: (node: Node) => void;
|
|
60
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Represents a CSS rule node for the {@link c} helper. Keys are CSS properties or nested selectors.
|
|
138
|
+
*/
|
|
61
139
|
export type CNode = {
|
|
62
140
|
[attribute_or_selector: string]: string | number | CNode | undefined;
|
|
63
141
|
};
|
|
64
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* Represents the root CSS object for the {@link c} helper. Keys are top-level selectors or at-rules.
|
|
144
|
+
*/
|
|
65
145
|
export type CRoot = Record<PropertyKey, CNode>;
|
|
66
146
|
/**
|
|
67
|
-
* A minimal
|
|
147
|
+
* A minimal CSS-in-JS helper that converts a JavaScript object hierarchy into a CSS string.
|
|
148
|
+
*
|
|
149
|
+
* @param root
|
|
150
|
+
*
|
|
151
|
+
* An object describing CSS rules.
|
|
152
|
+
* Keys are selectors or at-rules; values are either CSS property values or nested rule objects.
|
|
153
|
+
*
|
|
154
|
+
* @param splitter
|
|
155
|
+
*
|
|
156
|
+
* A delimiter used to create unique keys (default: `'$$'`).
|
|
157
|
+
* The substring from `splitter` to the end of a key is ignored (e.g., `src$$1` → `src`).
|
|
158
|
+
*
|
|
159
|
+
* @returns
|
|
68
160
|
*
|
|
69
|
-
*
|
|
161
|
+
* A CSS string representing the compiled rules.
|
|
70
162
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* -
|
|
74
|
-
* -
|
|
75
|
-
*
|
|
163
|
+
* @remarks
|
|
164
|
+
*
|
|
165
|
+
* - Keys whose values are primitives (`string` | `number`) are treated as CSS properties.
|
|
166
|
+
* - In property keys, uppercase letters become lowercase with a `-` prefix (e.g., `fontFamily` → `font-family`);
|
|
167
|
+
* underscores become hyphens (e.g., `font_family` → `font-family`).
|
|
168
|
+
* - Comma-separated selector keys expand into multiple selectors
|
|
169
|
+
* (e.g., `{ div: { '.a,.b': { margin: 1 } } }` → `div.a,div.b{margin:1}`).
|
|
170
|
+
* - Top-level keys starting with `@` (at-rules) are not concatenated with child selectors.
|
|
76
171
|
*/
|
|
77
172
|
export declare const c: (root: CRoot, splitter?: string) => string;
|
|
78
173
|
/**
|
|
79
|
-
* A responsive
|
|
174
|
+
* A responsive web design helper that generates CSS rules for a grid-like layout.
|
|
175
|
+
*
|
|
176
|
+
* @param root
|
|
177
|
+
*
|
|
178
|
+
* The CSS root object to populate (see {@link c}).
|
|
179
|
+
*
|
|
180
|
+
* @param selector
|
|
181
|
+
*
|
|
182
|
+
* The CSS selector for the grid item.
|
|
80
183
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
184
|
+
* @param cell_width_px
|
|
185
|
+
*
|
|
186
|
+
* The base cell width in pixels.
|
|
187
|
+
*
|
|
188
|
+
* @param cell_height_px
|
|
189
|
+
*
|
|
190
|
+
* The base cell height in pixels.
|
|
191
|
+
*
|
|
192
|
+
* @param specs
|
|
193
|
+
*
|
|
194
|
+
* An array of breakpoint specifications, each a tuple of:
|
|
195
|
+
* - `max_width`: Maximum number of cells per row (defines the viewport breakpoint).
|
|
196
|
+
* - `width` (optional, default `1`): Number of horizontal cells the element spans.
|
|
197
|
+
* - `height` (optional, default `1`): Number of vertical cells the element spans.
|
|
87
198
|
*/
|
|
88
199
|
export declare const rwd: (root: CRoot, selector: string, cell_width_px: number, cell_height_px: number, ...specs: [number, number?, number?][]) => void;
|
|
89
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* A map from value constructors (or `null`/`undefined`) to escape functions.
|
|
202
|
+
*
|
|
203
|
+
* Used by {@link escape_values} and {@link escape}.
|
|
204
|
+
*/
|
|
90
205
|
export type EscapeMap = Map<unknown, (value?: unknown) => string>;
|
|
91
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Escapes an array of values using the provided escape map.
|
|
208
|
+
*
|
|
209
|
+
* @param escape_map
|
|
210
|
+
*
|
|
211
|
+
* A map where keys are constructors (e.g., `String`, `Number`) and values are escape functions.
|
|
212
|
+
*
|
|
213
|
+
* @param values
|
|
214
|
+
*
|
|
215
|
+
* The array of values to escape.
|
|
216
|
+
*
|
|
217
|
+
* @returns
|
|
218
|
+
*
|
|
219
|
+
* An array of escaped strings.
|
|
220
|
+
*/
|
|
92
221
|
export declare const escape_values: (escape_map: EscapeMap, values: unknown[]) => string[];
|
|
93
|
-
/**
|
|
222
|
+
/**
|
|
223
|
+
* Escapes interpolated values in a tagged template literal using the provided escape map.
|
|
224
|
+
*
|
|
225
|
+
* @param escape_map
|
|
226
|
+
*
|
|
227
|
+
* A map where keys are constructors and values are escape functions.
|
|
228
|
+
*
|
|
229
|
+
* @param template
|
|
230
|
+
*
|
|
231
|
+
* The template strings array from the tagged template.
|
|
232
|
+
*
|
|
233
|
+
* @param values
|
|
234
|
+
*
|
|
235
|
+
* The interpolated values to escape.
|
|
236
|
+
*
|
|
237
|
+
* @returns
|
|
238
|
+
*
|
|
239
|
+
* The resulting string with all interpolated values escaped.
|
|
240
|
+
*/
|
|
94
241
|
export declare const escape: (escape_map: EscapeMap, template: TemplateStringsArray, ...values: unknown[]) => string;
|
|
95
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* Returns the appropriate Polish noun form based on a numeric value.
|
|
244
|
+
*
|
|
245
|
+
* Polish has three plural forms depending on the number:
|
|
246
|
+
* - Singular: used for exactly 1.
|
|
247
|
+
* - “Plural 2-4”: used for 2, 3, 4, 22, 23, 24, etc. (but not 12, 13, 14).
|
|
248
|
+
* - “Plural 5+”: used for 0, 5–21, 25–31, etc.
|
|
249
|
+
*
|
|
250
|
+
* @param singular
|
|
251
|
+
*
|
|
252
|
+
* The singular form (e.g., ”auto” for “car”).
|
|
253
|
+
*
|
|
254
|
+
* @param plural_2
|
|
255
|
+
*
|
|
256
|
+
* The form for 2, 3, 4 (e.g., “auta”).
|
|
257
|
+
*
|
|
258
|
+
* @param plural_5
|
|
259
|
+
*
|
|
260
|
+
* The form for 5+ (e.g., “aut”).
|
|
261
|
+
*
|
|
262
|
+
* @param value
|
|
263
|
+
*
|
|
264
|
+
* The numeric value to evaluate.
|
|
265
|
+
*
|
|
266
|
+
* @returns
|
|
267
|
+
*
|
|
268
|
+
* The appropriate noun form for the given value.
|
|
269
|
+
*/
|
|
96
270
|
export declare const pl_ural: (singular: string, plural_2: string, plural_5: string, value: number) => string;
|
|
97
271
|
/**
|
|
98
272
|
* Generates a UUID v1 (time-based) identifier.
|
|
99
273
|
*
|
|
100
|
-
*
|
|
274
|
+
* @param date
|
|
275
|
+
*
|
|
276
|
+
* The date to use for the timestamp portion (default: current date/time).
|
|
277
|
+
*
|
|
278
|
+
* @param node
|
|
279
|
+
*
|
|
280
|
+
* A hexadecimal `string` for the node portion (default: random).
|
|
281
|
+
* Must match `/^[0-9a-f]*$/`; it is trimmed to the last 12 characters and left-padded with zeros if shorter.
|
|
282
|
+
*
|
|
283
|
+
* @returns
|
|
284
|
+
*
|
|
285
|
+
* A UUID v1 `string` in the standard format `xxxxxxxx-xxxx-1xxx-xxxx-xxxxxxxxxxxx`.
|
|
101
286
|
*/
|
|
102
287
|
export declare const uuid_v1: (date?: Date, node?: string) => string;
|
|
103
288
|
/**
|
|
104
|
-
*
|
|
289
|
+
* Parses JSON with support for handler-based value transformation (“JavaScript ON”).
|
|
105
290
|
*
|
|
106
|
-
* Objects
|
|
291
|
+
* Objects with exactly one property whose key exists in `handlers` and whose value is an array
|
|
292
|
+
* are replaced by invoking the corresponding handler with the array elements as arguments.
|
|
107
293
|
*
|
|
108
|
-
*
|
|
109
|
-
* { "«handler_name»": [«params»] }
|
|
110
|
-
* ```
|
|
294
|
+
* @param handlers
|
|
111
295
|
*
|
|
112
|
-
*
|
|
296
|
+
* An object mapping handler names to functions.
|
|
113
297
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
298
|
+
* @param text
|
|
299
|
+
*
|
|
300
|
+
* The JSON string to parse.
|
|
301
|
+
*
|
|
302
|
+
* @returns
|
|
303
|
+
*
|
|
304
|
+
* The parsed value with handler substitutions applied.
|
|
117
305
|
*/
|
|
118
306
|
export declare const js_on_parse: (handlers: Record<PropertyKey, Function>, text: string) => any;
|
|
119
|
-
/**
|
|
307
|
+
/**
|
|
308
|
+
* Checks whether the argument is an array.
|
|
309
|
+
*
|
|
310
|
+
* @param arg
|
|
311
|
+
*
|
|
312
|
+
* The value to check.
|
|
313
|
+
*
|
|
314
|
+
* @returns
|
|
315
|
+
*
|
|
316
|
+
* `true` if `arg` is an array, `false` otherwise.
|
|
317
|
+
*/
|
|
120
318
|
export declare const is_array: (arg: unknown) => arg is unknown[];
|
|
121
|
-
/**
|
|
319
|
+
/**
|
|
320
|
+
* Checks whether the argument is a finite number (excludes `±Infinity` and `NaN`).
|
|
321
|
+
*
|
|
322
|
+
* @param arg
|
|
323
|
+
*
|
|
324
|
+
* The value to check.
|
|
325
|
+
*
|
|
326
|
+
* @returns
|
|
327
|
+
*
|
|
328
|
+
* `true` if `arg` is a finite number, `false` otherwise.
|
|
329
|
+
*/
|
|
122
330
|
export declare const is_finite_number: (arg: unknown) => arg is number;
|
|
123
|
-
/**
|
|
331
|
+
/**
|
|
332
|
+
* Checks whether the argument is of type `number` (includes `NaN` and `±Infinity`).
|
|
333
|
+
*
|
|
334
|
+
* @param arg
|
|
335
|
+
*
|
|
336
|
+
* The value to check.
|
|
337
|
+
*
|
|
338
|
+
* @returns
|
|
339
|
+
*
|
|
340
|
+
* `true` if `typeof arg === 'number'`, `false` otherwise.
|
|
341
|
+
*/
|
|
124
342
|
export declare const is_number: (arg: unknown) => arg is number;
|
|
125
|
-
/**
|
|
343
|
+
/**
|
|
344
|
+
* Checks whether the argument is a plain object (not `null` and not an array).
|
|
345
|
+
*
|
|
346
|
+
* @param arg
|
|
347
|
+
*
|
|
348
|
+
* The value to check.
|
|
349
|
+
*
|
|
350
|
+
* @returns
|
|
351
|
+
*
|
|
352
|
+
* `true` if `arg` is a plain object, `false` otherwise.
|
|
353
|
+
*/
|
|
126
354
|
export declare const is_record: (arg: unknown) => arg is Record<PropertyKey, unknown>;
|
|
127
|
-
/**
|
|
355
|
+
/**
|
|
356
|
+
* Checks whether the argument is a string.
|
|
357
|
+
*
|
|
358
|
+
* @param arg
|
|
359
|
+
*
|
|
360
|
+
* The value to check.
|
|
361
|
+
*
|
|
362
|
+
* @returns
|
|
363
|
+
*
|
|
364
|
+
* `true` if `typeof arg === 'string'`, `false` otherwise.
|
|
365
|
+
*/
|
|
128
366
|
export declare const is_string: (arg: unknown) => arg is string;
|
|
129
|
-
/**
|
|
367
|
+
/**
|
|
368
|
+
* Checks whether an object has the specified key as its own property.
|
|
369
|
+
*
|
|
370
|
+
* A null-safe wrapper around `Object.hasOwn`.
|
|
371
|
+
*
|
|
372
|
+
* @param ref
|
|
373
|
+
*
|
|
374
|
+
* The object to check.
|
|
375
|
+
*
|
|
376
|
+
* @param key
|
|
377
|
+
*
|
|
378
|
+
* The property key to look for.
|
|
379
|
+
*
|
|
380
|
+
* @returns
|
|
381
|
+
*
|
|
382
|
+
* `true` if `ref` is not nullish and has `key` as an own property, `false` otherwise.
|
|
383
|
+
*/
|
|
130
384
|
export declare const has_own: (ref: unknown, key: unknown) => boolean;
|
|
131
|
-
/**
|
|
385
|
+
/**
|
|
386
|
+
* A Proxy-based helper for auto-vivification of nested object structures.
|
|
387
|
+
*
|
|
388
|
+
* Accessing any property on the returned proxy automatically creates an empty object if the property does not exist,
|
|
389
|
+
* allowing deep assignments without explicit null checks.
|
|
390
|
+
*
|
|
391
|
+
* @param ref
|
|
392
|
+
*
|
|
393
|
+
* The root object to wrap.
|
|
394
|
+
*
|
|
395
|
+
* @returns
|
|
396
|
+
*
|
|
397
|
+
* A proxy that auto-creates nested objects on property access.
|
|
398
|
+
*/
|
|
132
399
|
export declare const pro: (ref: unknown) => any;
|
|
133
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* Parses a CSV string into a two-dimensional array of strings.
|
|
402
|
+
*
|
|
403
|
+
* Supports quoted fields with escaped double quotes (`""`). Carriage returns are normalized.
|
|
404
|
+
*
|
|
405
|
+
* @param csv
|
|
406
|
+
*
|
|
407
|
+
* The CSV string to parse.
|
|
408
|
+
*
|
|
409
|
+
* @param separator
|
|
410
|
+
*
|
|
411
|
+
* The field delimiter (default: `','`).
|
|
412
|
+
*
|
|
413
|
+
* @returns
|
|
414
|
+
*
|
|
415
|
+
* A 2D array where each inner array represents a row of fields.
|
|
416
|
+
*/
|
|
134
417
|
export declare const csv_parse: (csv: string, separator?: string) => string[][];
|
|
135
|
-
/**
|
|
418
|
+
/**
|
|
419
|
+
* Creates a new object containing only the specified keys from the source object.
|
|
420
|
+
*
|
|
421
|
+
* A runtime equivalent of TypeScript’s `Pick<T, K>` utility type. See also {@link omit}.
|
|
422
|
+
*
|
|
423
|
+
* @param ref
|
|
424
|
+
*
|
|
425
|
+
* The source object.
|
|
426
|
+
*
|
|
427
|
+
* @param keys
|
|
428
|
+
*
|
|
429
|
+
* An array of keys to include in the result.
|
|
430
|
+
*
|
|
431
|
+
* @returns
|
|
432
|
+
*
|
|
433
|
+
* A new object with only the specified keys.
|
|
434
|
+
*/
|
|
136
435
|
export declare const pick: <T, K extends keyof T>(ref: T, keys: K[]) => Pick<T, K>;
|
|
137
|
-
/**
|
|
436
|
+
/**
|
|
437
|
+
* Creates a new object excluding the specified keys from the source object.
|
|
438
|
+
*
|
|
439
|
+
* A runtime equivalent of TypeScript’s `Omit<T, K>` utility type. See also {@link pick}.
|
|
440
|
+
*
|
|
441
|
+
* @param ref
|
|
442
|
+
*
|
|
443
|
+
* The source object.
|
|
444
|
+
*
|
|
445
|
+
* @param keys
|
|
446
|
+
*
|
|
447
|
+
* An array of keys to exclude from the result.
|
|
448
|
+
*
|
|
449
|
+
* @returns
|
|
450
|
+
*
|
|
451
|
+
* A new object without the specified keys.
|
|
452
|
+
*/
|
|
138
453
|
export declare const omit: <T, K extends keyof T>(ref: T, keys: unknown[]) => Omit<T, K>;
|