@design-edito/tools 0.2.3 → 0.2.5
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/agnostic/arrays/index.js +8 -8
- package/agnostic/arrays/random-pick/index.js +4 -4
- package/agnostic/colors/index.js +7 -7
- package/agnostic/colors/lighten-color/index.js +2 -2
- package/agnostic/colors/saturate-color/index.js +2 -2
- package/agnostic/css/index.js +8 -8
- package/agnostic/css/styles-set/index.js +4 -4
- package/agnostic/errors/index.js +2 -2
- package/agnostic/html/hyper-json/cast/index.js +7 -7
- package/agnostic/html/hyper-json/index.js +8 -8
- package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +7 -7
- package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +7 -7
- package/agnostic/html/hyper-json/tree/index.js +7 -7
- package/agnostic/html/hyper-json/utils/index.js +7 -7
- package/agnostic/html/index.js +20 -20
- package/agnostic/html/sanitize/index.js +4 -4
- package/agnostic/html/selector-to-element/index.js +4 -4
- package/agnostic/html/string-to-nodes/index.js +5 -5
- package/agnostic/misc/assert/index.js +3 -3
- package/agnostic/misc/index.js +22 -22
- package/agnostic/misc/logs/index.js +2 -2
- package/agnostic/misc/lorem-ipsum/index.js +11 -11
- package/agnostic/numbers/index.js +6 -6
- package/agnostic/objects/index.js +8 -8
- package/agnostic/strings/index.d.ts +2 -0
- package/agnostic/strings/index.js +9 -4
- package/agnostic/strings/matches/index.d.ts +4 -3
- package/agnostic/strings/matches/index.js +1 -1
- package/agnostic/strings/parse-table/index.d.ts +82 -0
- package/agnostic/strings/parse-table/index.js +10 -0
- package/agnostic/time/index.js +3 -3
- package/chunks/{chunk-V3PGGLMH.js → chunk-4XGNPFBN.js} +7 -7
- package/chunks/{chunk-XJ23DJY4.js → chunk-7GIJUKYP.js} +1 -1
- package/chunks/{chunk-C7SRAQMW.js → chunk-AQBJ6HNB.js} +1 -1
- package/chunks/{chunk-BXHICIJO.js → chunk-C7SDXW3B.js} +5 -5
- package/chunks/{chunk-HGCG2J77.js → chunk-F3WCF6DL.js} +1 -1
- package/chunks/chunk-GYELTEZT.js +60 -0
- package/chunks/{chunk-LQFKUNVQ.js → chunk-R3AWQXMY.js} +1 -0
- package/chunks/{chunk-X5HMM3LD.js → chunk-SKBOSWM2.js} +1 -1
- package/chunks/{chunk-XLL7WERQ.js → chunk-TBRLSFVL.js} +4 -4
- package/chunks/{chunk-P2H6PV4O.js → chunk-TIER4TF4.js} +1 -1
- package/chunks/{chunk-E4FJHD5R.js → chunk-WAMSK4A3.js} +1 -1
- package/chunks/{chunk-SO7OVQK2.js → chunk-WV2D6IX4.js} +4 -4
- package/chunks/{chunk-RDQJSWRC.js → chunk-XB3EGDBI.js} +1 -1
- package/chunks/{chunk-VSCF32XO.js → chunk-YRWLIDCE.js} +3 -3
- package/chunks/{chunk-WSKUUPV4.js → chunk-YWOU65KY.js} +19 -19
- package/chunks/{chunk-CQEDNACN.js → chunk-ZBBU2P4D.js} +2 -2
- package/node/@aws-s3/index.js +9 -9
- package/node/@aws-s3/storage/directory/index.js +6 -6
- package/node/@aws-s3/storage/file/index.js +9 -9
- package/node/@aws-s3/storage/index.js +11 -11
- package/node/@google-cloud/index.js +14 -14
- package/node/@google-cloud/storage/bucket/index.js +5 -5
- package/node/@google-cloud/storage/directory/index.js +6 -6
- package/node/@google-cloud/storage/file/index.js +17 -17
- package/node/@google-cloud/storage/index.js +17 -17
- package/node/cloud-storage/index.js +46 -46
- package/node/cloud-storage/operations/copy-dir/index.js +3 -3
- package/node/cloud-storage/operations/copy-file/index.js +3 -3
- package/node/cloud-storage/operations/download-file/index.js +3 -3
- package/node/cloud-storage/operations/exists-file/index.js +3 -3
- package/node/cloud-storage/operations/index.js +54 -54
- package/node/cloud-storage/operations/list-dir/index.js +3 -3
- package/node/cloud-storage/operations/move-dir/index.js +3 -3
- package/node/cloud-storage/operations/move-file/index.js +3 -3
- package/node/cloud-storage/operations/remove-dir/index.js +3 -3
- package/node/cloud-storage/operations/remove-file/index.js +3 -3
- package/node/cloud-storage/operations/stat-file/index.js +3 -3
- package/node/cloud-storage/operations/upload-file/index.js +3 -3
- package/node/encryption/index.js +3 -3
- package/node/files/index.js +4 -4
- package/node/files/subpaths/index.js +2 -2
- package/node/ftps/directory/index.js +6 -6
- package/node/ftps/file/index.js +9 -9
- package/node/ftps/index.js +10 -10
- package/node/images/index.js +11 -11
- package/node/images/transform/index.js +5 -5
- package/node/sftp/directory/index.js +6 -6
- package/node/sftp/file/index.js +9 -9
- package/node/sftp/index.js +8 -8
- package/package.json +1 -1
- package/chunks/{chunk-MJCOPMAD.js → chunk-24ZUWYIR.js} +5 -5
- package/chunks/{chunk-U57Q62IN.js → chunk-3LAWRHHB.js} +3 -3
- package/chunks/{chunk-UWHQFQI2.js → chunk-646R6BQZ.js} +5 -5
- package/chunks/{chunk-GJGGDURA.js → chunk-6NLNUGBI.js} +5 -5
- package/chunks/{chunk-QT6N2QNW.js → chunk-CA3UPHYO.js} +5 -5
- package/chunks/{chunk-WWEDO42X.js → chunk-DPQRXSZH.js} +5 -5
- package/chunks/{chunk-VTZRFTRR.js → chunk-EOTOFHUR.js} +5 -5
- package/chunks/{chunk-AQOBWV4U.js → chunk-FAZEIFCI.js} +14 -14
- package/chunks/{chunk-NAN5WRTL.js → chunk-FS6LRTDK.js} +5 -5
- package/chunks/{chunk-RCCKFZCR.js → chunk-H4LW6FP3.js} +5 -5
- package/chunks/{chunk-JL6A5SAJ.js → chunk-KA3PLDPZ.js} +8 -8
- package/chunks/{chunk-ALRRTVAV.js → chunk-KE7RNBSU.js} +16 -16
- package/chunks/{chunk-LE23WL3C.js → chunk-KQAPQMHJ.js} +5 -5
- package/chunks/{chunk-GVGW5ZR6.js → chunk-KSS2ZJHI.js} +17 -17
- package/chunks/{chunk-X7KWB2VQ.js → chunk-MJQF3YZO.js} +3 -3
- package/chunks/{chunk-3T67XKWX.js → chunk-NOLQR5RW.js} +5 -5
- package/chunks/{chunk-JVFAQFHD.js → chunk-OA7Y2A5T.js} +5 -5
- package/chunks/{chunk-MB7HWF22.js → chunk-PXRLKO5Y.js} +3 -3
- package/chunks/{chunk-4HPG6TEE.js → chunk-QXVZJYNY.js} +5 -5
- package/chunks/{chunk-BGMAL4RK.js → chunk-SQL5JXYJ.js} +8 -8
- package/chunks/{chunk-VRFYLKZW.js → chunk-UK4HNSEJ.js} +5 -5
- package/chunks/{chunk-OMTDHKJI.js → chunk-UXEKCYL7.js} +4 -4
- package/chunks/{chunk-2KT7AKRW.js → chunk-WH6BPDAC.js} +3 -3
- package/chunks/{chunk-IGFA7IDA.js → chunk-XKRFL2AB.js} +5 -5
- package/chunks/{chunk-G6C3VTOA.js → chunk-XPGDKBTU.js} +5 -5
- package/chunks/{chunk-4PISR74R.js → chunk-ZQ3DJPY5.js} +8 -8
@@ -1,3 +1,9 @@
|
|
1
|
+
import {
|
2
|
+
absoluteModulo
|
3
|
+
} from "../../chunks/chunk-DNIOWD7K.js";
|
4
|
+
import {
|
5
|
+
clamp
|
6
|
+
} from "../../chunks/chunk-OSAXBA7G.js";
|
1
7
|
import {
|
2
8
|
interpolate
|
3
9
|
} from "../../chunks/chunk-BJAYUP7M.js";
|
@@ -8,12 +14,6 @@ import {
|
|
8
14
|
import {
|
9
15
|
round
|
10
16
|
} from "../../chunks/chunk-32IRF4OP.js";
|
11
|
-
import {
|
12
|
-
absoluteModulo
|
13
|
-
} from "../../chunks/chunk-DNIOWD7K.js";
|
14
|
-
import {
|
15
|
-
clamp
|
16
|
-
} from "../../chunks/chunk-OSAXBA7G.js";
|
17
17
|
import "../../chunks/chunk-WSFCRVEQ.js";
|
18
18
|
|
19
19
|
// src/agnostic/numbers/index.ts
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
recordFormat
|
3
|
+
} from "../../chunks/chunk-YP64J65L.js";
|
4
|
+
import {
|
5
|
+
recordMap
|
6
|
+
} from "../../chunks/chunk-XNF5MLCQ.js";
|
5
7
|
import {
|
6
8
|
Validation
|
7
9
|
} from "../../chunks/chunk-FPEW3A27.js";
|
@@ -19,11 +21,9 @@ import {
|
|
19
21
|
flattenGetters
|
20
22
|
} from "../../chunks/chunk-VFJYLXCI.js";
|
21
23
|
import {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
recordFormat
|
26
|
-
} from "../../chunks/chunk-YP64J65L.js";
|
24
|
+
isNonNullObject,
|
25
|
+
isObject
|
26
|
+
} from "../../chunks/chunk-HQLRJ7XW.js";
|
27
27
|
import "../../chunks/chunk-SNJJII7A.js";
|
28
28
|
import "../../chunks/chunk-QXAJXTXV.js";
|
29
29
|
import "../../chunks/chunk-HC6ZOHCS.js";
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { CharCodes as CharCodesNamespace } from './char-codes';
|
2
2
|
import { matches as matchesFunc, matchesSome as matchesSomeFunc, matchesEvery as matchesEveryFunc } from './matches';
|
3
|
+
import { parseTable as parseTableFunc } from './parse-table';
|
3
4
|
import { replaceAll as replaceAllFunc } from './replace-all';
|
4
5
|
import { normalizeIndent as normalizeIndentFunc } from './normalize-indent';
|
5
6
|
import { toAlphanum as toAlphanumFunc } from './to-alphanum';
|
@@ -10,6 +11,7 @@ export declare namespace Strings {
|
|
10
11
|
const matchesSome: typeof matchesSomeFunc;
|
11
12
|
const matchesEvery: typeof matchesEveryFunc;
|
12
13
|
const normalizeIndent: typeof normalizeIndentFunc;
|
14
|
+
const parseTable: typeof parseTableFunc;
|
13
15
|
const replaceAll: typeof replaceAllFunc;
|
14
16
|
const toAlphanum: typeof toAlphanumFunc;
|
15
17
|
const trimStart: typeof trimStartFunc;
|
@@ -5,16 +5,20 @@ import {
|
|
5
5
|
matches,
|
6
6
|
matchesEvery,
|
7
7
|
matchesSome
|
8
|
-
} from "../../chunks/chunk-
|
9
|
-
import {
|
10
|
-
replaceAll
|
11
|
-
} from "../../chunks/chunk-ZTDVUXPR.js";
|
8
|
+
} from "../../chunks/chunk-R3AWQXMY.js";
|
12
9
|
import {
|
13
10
|
normalizeIndent
|
14
11
|
} from "../../chunks/chunk-JQXNEJAP.js";
|
12
|
+
import {
|
13
|
+
replaceAll
|
14
|
+
} from "../../chunks/chunk-ZTDVUXPR.js";
|
15
15
|
import {
|
16
16
|
toAlphanum
|
17
17
|
} from "../../chunks/chunk-COVPTTAD.js";
|
18
|
+
import {
|
19
|
+
parseTable
|
20
|
+
} from "../../chunks/chunk-GYELTEZT.js";
|
21
|
+
import "../../chunks/chunk-JMU5PDBD.js";
|
18
22
|
import {
|
19
23
|
trimEnd,
|
20
24
|
trimStart
|
@@ -29,6 +33,7 @@ var Strings;
|
|
29
33
|
Strings2.matchesSome = matchesSome;
|
30
34
|
Strings2.matchesEvery = matchesEvery;
|
31
35
|
Strings2.normalizeIndent = normalizeIndent;
|
36
|
+
Strings2.parseTable = parseTable;
|
32
37
|
Strings2.replaceAll = replaceAll;
|
33
38
|
Strings2.toAlphanum = toAlphanum;
|
34
39
|
Strings2.trimStart = trimStart;
|
@@ -1,3 +1,4 @@
|
|
1
|
-
export
|
2
|
-
export declare function
|
3
|
-
export declare function
|
1
|
+
export type Matcher = string | RegExp | ((input: string) => boolean);
|
2
|
+
export declare function matches(input: string, matcher: Matcher): boolean;
|
3
|
+
export declare function matchesSome(input: string, matchers: Matcher | Array<Matcher>): boolean;
|
4
|
+
export declare function matchesEvery(input: string, matchers: Matcher | Array<Matcher>): boolean;
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import { Outcome } from '../../misc/outcome';
|
2
|
+
export type ParseTableOptions<T extends Record<string, string>> = {
|
3
|
+
inputToLines: (input: string) => string[];
|
4
|
+
headLinePos: number;
|
5
|
+
headLineToHeaders: (input: string) => string[];
|
6
|
+
bodyLinesBounds: [number, number];
|
7
|
+
bodyLineToCellValue: (input: string) => string[];
|
8
|
+
schema: (obj: unknown) => T;
|
9
|
+
} | {
|
10
|
+
inputToLines: (input: string) => string[];
|
11
|
+
headLinePos: number;
|
12
|
+
bodyLinesBounds: [number, number];
|
13
|
+
columns: number[];
|
14
|
+
headerRefine: (header: string) => string;
|
15
|
+
valueRefine: (value: string) => string;
|
16
|
+
schema: (obj: unknown) => T;
|
17
|
+
};
|
18
|
+
export declare const defaultOptions: ParseTableOptions<any>;
|
19
|
+
/**
|
20
|
+
* Parses a tabular string input into an array of objects, where each object represents a row in the table.
|
21
|
+
*
|
22
|
+
* There are two parsing modes:
|
23
|
+
*
|
24
|
+
* 1. **Delimiter-based parsing**
|
25
|
+
* - The table is split into rows and then into cells using user-provided functions (e.g., splitting on `\n` and `\t`).
|
26
|
+
* - The header row is parsed into an array of header names, which are mapped to each cell value.
|
27
|
+
*
|
28
|
+
* 2. **Column-slice parsing**
|
29
|
+
* - The table is split into fixed-width columns based on start indices provided in `options.columns`.
|
30
|
+
* - The header row and body rows are sliced using these column boundaries.
|
31
|
+
* - Each header and cell value can be refined with user-provided functions.
|
32
|
+
*
|
33
|
+
* @template T - The type of the objects in the resulting array, extending `Record<string, string>`.
|
34
|
+
* @param {string} table - The string representation of the table to be parsed.
|
35
|
+
* @param {ParseTableOptions<T>} [options=defaultOptions] - Configuration options for parsing the table.
|
36
|
+
*
|
37
|
+
* ### Common Options
|
38
|
+
* @param {function(string): string[]} options.inputToLines - Function to split the input string into lines.
|
39
|
+
* @param {number} options.headLinePos - The index of the header line in the lines array.
|
40
|
+
* @param {[number, number]} options.bodyLinesBounds - Tuple `[start, end]` indicating the range of lines to parse as body rows.
|
41
|
+
* @param {function(unknown): T} options.schema - Function to validate and transform each row object.
|
42
|
+
*
|
43
|
+
* ### Delimiter-based Options
|
44
|
+
* @param {function(string): string[]} options.headLineToHeaders - Function to parse the header line into an array of header names.
|
45
|
+
* @param {function(string): string[]} options.bodyLineToCellValue - Function to parse each body line into an array of cell values.
|
46
|
+
*
|
47
|
+
* ### Column-slice Options
|
48
|
+
* @param {number[]} options.columns - An array of starting indices for each column. The last column extends to the end of the line.
|
49
|
+
* @param {function(string): string} options.headerRefine - Function to clean or normalize header names.
|
50
|
+
* @param {function(string): string} options.valueRefine - Function to clean or normalize cell values.
|
51
|
+
*
|
52
|
+
* @returns {Outcome.Either<T[], string>} An `Outcome` object containing either:
|
53
|
+
* - `success = true` with an array of parsed row objects, or
|
54
|
+
* - `success = false` with an error message.
|
55
|
+
*
|
56
|
+
* @throws Will throw an error if the header line cannot be found.
|
57
|
+
*
|
58
|
+
* @example
|
59
|
+
* // Delimiter-based parsing
|
60
|
+
* const table = 'name\tage\nAlice\t30\nBob\t25';
|
61
|
+
* const result = parseTable(table);
|
62
|
+
* if (result.success) {
|
63
|
+
* console.log(result.payload); // [{ name: 'Alice', age: '30' }, { name: 'Bob', age: '25' }]
|
64
|
+
* }
|
65
|
+
*
|
66
|
+
* @example
|
67
|
+
* // Column-slice parsing
|
68
|
+
* const table = 'Name Age\nAlice 30 \nBob 25 ';
|
69
|
+
* const result = parseTable(table, {
|
70
|
+
* inputToLines: i => i.split('\n'),
|
71
|
+
* headLinePos: 0,
|
72
|
+
* bodyLinesBounds: [1, Infinity],
|
73
|
+
* columns: [0, 10, 15], // start indices for each column
|
74
|
+
* headerRefine: h => h.trim(),
|
75
|
+
* valueRefine: v => v.trim(),
|
76
|
+
* schema: row => row
|
77
|
+
* });
|
78
|
+
* if (result.success) {
|
79
|
+
* console.log(result.payload); // [{ Name: 'Alice', Age: '30' }, { Name: 'Bob', Age: '25' }]
|
80
|
+
* }
|
81
|
+
*/
|
82
|
+
export declare function parseTable<T extends Record<string, string>>(table: string, options?: ParseTableOptions<T>): Outcome.Either<T[], string>;
|
package/agnostic/time/index.js
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
import {
|
2
|
+
timeout
|
3
|
+
} from "../../chunks/chunk-Z7ZDDBV5.js";
|
1
4
|
import {
|
2
5
|
Transitions
|
3
6
|
} from "../../chunks/chunk-ENMBK6H7.js";
|
@@ -8,9 +11,6 @@ import "../../chunks/chunk-YQWZ3EP2.js";
|
|
8
11
|
import {
|
9
12
|
Duration
|
10
13
|
} from "../../chunks/chunk-6NYUQXJT.js";
|
11
|
-
import {
|
12
|
-
timeout
|
13
|
-
} from "../../chunks/chunk-Z7ZDDBV5.js";
|
14
14
|
import {
|
15
15
|
wait
|
16
16
|
} from "../../chunks/chunk-4CIS3R7T.js";
|
@@ -1,19 +1,19 @@
|
|
1
|
+
import {
|
2
|
+
isArrayOf
|
3
|
+
} from "./chunk-6RGDWX4A.js";
|
1
4
|
import {
|
2
5
|
shuffle
|
3
6
|
} from "./chunk-VJJIYJMY.js";
|
7
|
+
import {
|
8
|
+
randomPick,
|
9
|
+
randomPickMany
|
10
|
+
} from "./chunk-AQBJ6HNB.js";
|
4
11
|
import {
|
5
12
|
findDuplicates
|
6
13
|
} from "./chunk-YS6WMSWC.js";
|
7
14
|
import {
|
8
15
|
make
|
9
16
|
} from "./chunk-RLAZR3NL.js";
|
10
|
-
import {
|
11
|
-
isArrayOf
|
12
|
-
} from "./chunk-6RGDWX4A.js";
|
13
|
-
import {
|
14
|
-
randomPick,
|
15
|
-
randomPickMany
|
16
|
-
} from "./chunk-C7SRAQMW.js";
|
17
17
|
|
18
18
|
// src/agnostic/arrays/index.tsx
|
19
19
|
var Arrays;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
} from "./chunk-
|
2
|
+
file_exports
|
3
|
+
} from "./chunk-KE7RNBSU.js";
|
4
4
|
import {
|
5
5
|
bucket_exports
|
6
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-UXEKCYL7.js";
|
7
7
|
import {
|
8
|
-
|
9
|
-
} from "./chunk-
|
8
|
+
directory_exports
|
9
|
+
} from "./chunk-QXVZJYNY.js";
|
10
10
|
import {
|
11
11
|
__export
|
12
12
|
} from "./chunk-WSFCRVEQ.js";
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import {
|
2
|
+
Outcome
|
3
|
+
} from "./chunk-JMU5PDBD.js";
|
4
|
+
|
5
|
+
// src/agnostic/strings/parse-table/index.ts
|
6
|
+
var defaultOptions = {
|
7
|
+
inputToLines: (i) => i.split("\n"),
|
8
|
+
headLinePos: 0,
|
9
|
+
headLineToHeaders: (i) => i.split(" "),
|
10
|
+
bodyLinesBounds: [1, Infinity],
|
11
|
+
bodyLineToCellValue: (i) => i.split(" "),
|
12
|
+
schema: (i) => i
|
13
|
+
};
|
14
|
+
function parseTable(table, options = defaultOptions) {
|
15
|
+
const lines = options.inputToLines(table);
|
16
|
+
const headLine = lines.at(options.headLinePos);
|
17
|
+
if (headLine === void 0) return Outcome.makeFailure("Head line not found");
|
18
|
+
if ("headLineToHeaders" in options) {
|
19
|
+
const headers = options.headLineToHeaders(headLine);
|
20
|
+
const bodyLines = lines.slice(options.bodyLinesBounds[0], options.bodyLinesBounds[1]);
|
21
|
+
const bodyLinesSplit = bodyLines.map(options.bodyLineToCellValue);
|
22
|
+
const rows = bodyLinesSplit.map((line) => {
|
23
|
+
const row = {};
|
24
|
+
line.forEach((cell, cellPos) => {
|
25
|
+
const cellName = headers.at(cellPos);
|
26
|
+
if (cellName === void 0) return;
|
27
|
+
const cellValue = cell;
|
28
|
+
row[cellName] = cellValue;
|
29
|
+
});
|
30
|
+
const checked = options.schema(row);
|
31
|
+
return checked;
|
32
|
+
});
|
33
|
+
return Outcome.makeSuccess(rows);
|
34
|
+
} else {
|
35
|
+
const colBounds = options.columns.reduce((acc, colStartPos, colIndex) => {
|
36
|
+
const nextColStartPos = options.columns.at(colIndex + 1);
|
37
|
+
if (nextColStartPos === void 0) return [...acc, [colStartPos, Infinity]];
|
38
|
+
return [...acc, [colStartPos, nextColStartPos]];
|
39
|
+
}, []);
|
40
|
+
const bodyLines = lines.slice(options.bodyLinesBounds[0], options.bodyLinesBounds[1]);
|
41
|
+
const headers = colBounds.map(([start, end]) => options.headerRefine(headLine.slice(start, end)));
|
42
|
+
const rows = bodyLines.map((line) => {
|
43
|
+
const row = {};
|
44
|
+
colBounds.forEach(([start, end], colIndex) => {
|
45
|
+
const header = headers.at(colIndex);
|
46
|
+
if (header === void 0) return;
|
47
|
+
const cellValue = line.slice(start, end);
|
48
|
+
row[header] = cellValue;
|
49
|
+
});
|
50
|
+
const checked = options.schema(row);
|
51
|
+
return checked;
|
52
|
+
});
|
53
|
+
return Outcome.makeSuccess(rows);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
export {
|
58
|
+
defaultOptions,
|
59
|
+
parseTable
|
60
|
+
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// src/agnostic/strings/matches/index.ts
|
2
2
|
function matches(input, matcher) {
|
3
3
|
if (typeof matcher === "string") return input === matcher;
|
4
|
+
if (typeof matcher === "function") return matcher(input);
|
4
5
|
return input.match(matcher) !== null;
|
5
6
|
}
|
6
7
|
function matchesSome(input, matchers) {
|
@@ -2,16 +2,16 @@ import {
|
|
2
2
|
Cast,
|
3
3
|
Tree,
|
4
4
|
Utils
|
5
|
-
} from "./chunk-
|
6
|
-
import {
|
7
|
-
Serialize
|
8
|
-
} from "./chunk-SXRWMH3U.js";
|
5
|
+
} from "./chunk-KSS2ZJHI.js";
|
9
6
|
import {
|
10
7
|
Types
|
11
8
|
} from "./chunk-XEQ2PBT2.js";
|
12
9
|
import {
|
13
10
|
SmartTags
|
14
11
|
} from "./chunk-UT2J62LH.js";
|
12
|
+
import {
|
13
|
+
Serialize
|
14
|
+
} from "./chunk-SXRWMH3U.js";
|
15
15
|
import {
|
16
16
|
Transformer
|
17
17
|
} from "./chunk-BKO7GLC2.js";
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
file_exports
|
3
|
-
} from "./chunk-4PISR74R.js";
|
4
1
|
import {
|
5
2
|
directory_exports
|
6
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-XPGDKBTU.js";
|
4
|
+
import {
|
5
|
+
file_exports
|
6
|
+
} from "./chunk-ZQ3DJPY5.js";
|
7
7
|
import {
|
8
8
|
__export
|
9
9
|
} from "./chunk-WSFCRVEQ.js";
|
@@ -1,36 +1,36 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
} from "./chunk-
|
2
|
+
exists_file_exports
|
3
|
+
} from "./chunk-24ZUWYIR.js";
|
4
|
+
import {
|
5
|
+
remove_dir_exports
|
6
|
+
} from "./chunk-CA3UPHYO.js";
|
4
7
|
import {
|
5
8
|
remove_file_exports
|
6
|
-
} from "./chunk-
|
9
|
+
} from "./chunk-H4LW6FP3.js";
|
7
10
|
import {
|
8
|
-
|
9
|
-
} from "./chunk-
|
11
|
+
move_file_exports
|
12
|
+
} from "./chunk-646R6BQZ.js";
|
10
13
|
import {
|
11
|
-
|
12
|
-
} from "./chunk-
|
14
|
+
list_dir_exports
|
15
|
+
} from "./chunk-DPQRXSZH.js";
|
13
16
|
import {
|
14
17
|
stat_file_exports
|
15
|
-
} from "./chunk-
|
18
|
+
} from "./chunk-UK4HNSEJ.js";
|
16
19
|
import {
|
17
|
-
|
18
|
-
} from "./chunk-
|
19
|
-
import {
|
20
|
-
copy_file_exports
|
21
|
-
} from "./chunk-JVFAQFHD.js";
|
20
|
+
upload_file_exports
|
21
|
+
} from "./chunk-NOLQR5RW.js";
|
22
22
|
import {
|
23
23
|
copy_dir_exports
|
24
|
-
} from "./chunk-
|
24
|
+
} from "./chunk-6NLNUGBI.js";
|
25
25
|
import {
|
26
|
-
|
27
|
-
} from "./chunk-
|
26
|
+
copy_file_exports
|
27
|
+
} from "./chunk-OA7Y2A5T.js";
|
28
28
|
import {
|
29
29
|
download_file_exports
|
30
|
-
} from "./chunk-
|
30
|
+
} from "./chunk-EOTOFHUR.js";
|
31
31
|
import {
|
32
|
-
|
33
|
-
} from "./chunk-
|
32
|
+
move_dir_exports
|
33
|
+
} from "./chunk-FS6LRTDK.js";
|
34
34
|
import {
|
35
35
|
__export
|
36
36
|
} from "./chunk-WSFCRVEQ.js";
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import {
|
2
2
|
Sanitize
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-XB3EGDBI.js";
|
4
4
|
import {
|
5
5
|
register
|
6
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-TIER4TF4.js";
|
7
7
|
|
8
8
|
// src/agnostic/html/string-to-nodes/index.ts
|
9
9
|
function stringToNodes(dirtyStr, options) {
|
package/node/@aws-s3/index.js
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
import {
|
2
2
|
storage_exports
|
3
|
-
} from "../../chunks/chunk-
|
4
|
-
import "../../chunks/chunk-
|
5
|
-
import "../../chunks/chunk-
|
6
|
-
import "../../chunks/chunk-
|
3
|
+
} from "../../chunks/chunk-WV2D6IX4.js";
|
4
|
+
import "../../chunks/chunk-XPGDKBTU.js";
|
5
|
+
import "../../chunks/chunk-ZQ3DJPY5.js";
|
6
|
+
import "../../chunks/chunk-ZEZCYPLQ.js";
|
7
|
+
import "../../chunks/chunk-4XSDRT23.js";
|
7
8
|
import "../../chunks/chunk-3TKBCG7Y.js";
|
9
|
+
import "../../chunks/chunk-QWZ4ZNFA.js";
|
8
10
|
import "../../chunks/chunk-ZSUG52DO.js";
|
9
|
-
import "../../chunks/chunk-FD5WR2A5.js";
|
10
11
|
import "../../chunks/chunk-VROZGPC5.js";
|
11
|
-
import "../../chunks/chunk-
|
12
|
-
import "../../chunks/chunk-C6QTHDDM.js";
|
12
|
+
import "../../chunks/chunk-FD5WR2A5.js";
|
13
13
|
import "../../chunks/chunk-4XBUJAQU.js";
|
14
|
-
import "../../chunks/chunk-
|
14
|
+
import "../../chunks/chunk-C6QTHDDM.js";
|
15
15
|
import "../../chunks/chunk-IV75M3KE.js";
|
16
|
-
import "../../chunks/chunk-
|
16
|
+
import "../../chunks/chunk-ON6LC3HE.js";
|
17
17
|
import "../../chunks/chunk-JMU5PDBD.js";
|
18
18
|
import "../../chunks/chunk-FENXVJYO.js";
|
19
19
|
import "../../chunks/chunk-WSFCRVEQ.js";
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import "../../../../chunks/chunk-
|
1
|
+
import "../../../../chunks/chunk-XPGDKBTU.js";
|
2
2
|
import {
|
3
|
-
|
4
|
-
} from "../../../../chunks/chunk-
|
3
|
+
remove_dir_exports
|
4
|
+
} from "../../../../chunks/chunk-4XSDRT23.js";
|
5
5
|
import {
|
6
6
|
list_exports
|
7
7
|
} from "../../../../chunks/chunk-ZSUG52DO.js";
|
8
|
-
import {
|
9
|
-
remove_dir_exports
|
10
|
-
} from "../../../../chunks/chunk-4XSDRT23.js";
|
11
8
|
import {
|
12
9
|
copy_dir_exports
|
13
10
|
} from "../../../../chunks/chunk-4XBUJAQU.js";
|
11
|
+
import {
|
12
|
+
move_dir_exports
|
13
|
+
} from "../../../../chunks/chunk-ON6LC3HE.js";
|
14
14
|
import "../../../../chunks/chunk-JMU5PDBD.js";
|
15
15
|
import "../../../../chunks/chunk-FENXVJYO.js";
|
16
16
|
import "../../../../chunks/chunk-WSFCRVEQ.js";
|
@@ -1,25 +1,25 @@
|
|
1
|
-
import "../../../../chunks/chunk-
|
1
|
+
import "../../../../chunks/chunk-ZQ3DJPY5.js";
|
2
|
+
import {
|
3
|
+
exists_exports
|
4
|
+
} from "../../../../chunks/chunk-ZEZCYPLQ.js";
|
2
5
|
import {
|
3
6
|
remove_exports
|
4
7
|
} from "../../../../chunks/chunk-3TKBCG7Y.js";
|
5
8
|
import {
|
6
|
-
|
7
|
-
} from "../../../../chunks/chunk-
|
9
|
+
move_exports
|
10
|
+
} from "../../../../chunks/chunk-QWZ4ZNFA.js";
|
8
11
|
import {
|
9
12
|
stat_exports
|
10
13
|
} from "../../../../chunks/chunk-VROZGPC5.js";
|
14
|
+
import {
|
15
|
+
upload_exports
|
16
|
+
} from "../../../../chunks/chunk-FD5WR2A5.js";
|
11
17
|
import {
|
12
18
|
copy_exports
|
13
19
|
} from "../../../../chunks/chunk-C6QTHDDM.js";
|
14
|
-
import {
|
15
|
-
exists_exports
|
16
|
-
} from "../../../../chunks/chunk-ZEZCYPLQ.js";
|
17
20
|
import {
|
18
21
|
download_exports
|
19
22
|
} from "../../../../chunks/chunk-IV75M3KE.js";
|
20
|
-
import {
|
21
|
-
move_exports
|
22
|
-
} from "../../../../chunks/chunk-QWZ4ZNFA.js";
|
23
23
|
import "../../../../chunks/chunk-JMU5PDBD.js";
|
24
24
|
import "../../../../chunks/chunk-FENXVJYO.js";
|
25
25
|
import "../../../../chunks/chunk-WSFCRVEQ.js";
|
@@ -1,21 +1,21 @@
|
|
1
|
-
import "../../../chunks/chunk-
|
2
|
-
import {
|
3
|
-
file_exports
|
4
|
-
} from "../../../chunks/chunk-4PISR74R.js";
|
1
|
+
import "../../../chunks/chunk-WV2D6IX4.js";
|
5
2
|
import {
|
6
3
|
directory_exports
|
7
|
-
} from "../../../chunks/chunk-
|
8
|
-
import
|
4
|
+
} from "../../../chunks/chunk-XPGDKBTU.js";
|
5
|
+
import {
|
6
|
+
file_exports
|
7
|
+
} from "../../../chunks/chunk-ZQ3DJPY5.js";
|
8
|
+
import "../../../chunks/chunk-ZEZCYPLQ.js";
|
9
|
+
import "../../../chunks/chunk-4XSDRT23.js";
|
9
10
|
import "../../../chunks/chunk-3TKBCG7Y.js";
|
11
|
+
import "../../../chunks/chunk-QWZ4ZNFA.js";
|
10
12
|
import "../../../chunks/chunk-ZSUG52DO.js";
|
11
|
-
import "../../../chunks/chunk-FD5WR2A5.js";
|
12
13
|
import "../../../chunks/chunk-VROZGPC5.js";
|
13
|
-
import "../../../chunks/chunk-
|
14
|
-
import "../../../chunks/chunk-C6QTHDDM.js";
|
14
|
+
import "../../../chunks/chunk-FD5WR2A5.js";
|
15
15
|
import "../../../chunks/chunk-4XBUJAQU.js";
|
16
|
-
import "../../../chunks/chunk-
|
16
|
+
import "../../../chunks/chunk-C6QTHDDM.js";
|
17
17
|
import "../../../chunks/chunk-IV75M3KE.js";
|
18
|
-
import "../../../chunks/chunk-
|
18
|
+
import "../../../chunks/chunk-ON6LC3HE.js";
|
19
19
|
import "../../../chunks/chunk-JMU5PDBD.js";
|
20
20
|
import "../../../chunks/chunk-FENXVJYO.js";
|
21
21
|
import "../../../chunks/chunk-WSFCRVEQ.js";
|