df-script 1.6.0 → 1.7.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/README.md +1 -1
- package/dist/api.d.ts +2 -1
- package/dist/assets/index-DBhGK6Tp.css +1 -0
- package/dist/assets/index-DEJEV_tU.js +195 -0
- package/dist/columnExpressions/ColumnExpr.d.ts +12 -5
- package/dist/columnExpressions/ExprBase.d.ts +26 -12
- package/dist/columnExpressions/constants.d.ts +1 -0
- package/dist/columnExpressions/functions/all.d.ts +23 -0
- package/dist/columnExpressions/functions/coalesce.d.ts +29 -0
- package/dist/columnExpressions/functions/element.d.ts +25 -0
- package/dist/columnExpressions/functions/exclude.d.ts +24 -0
- package/dist/columnExpressions/functions/implode.d.ts +28 -0
- package/dist/columnExpressions/functions/lit.d.ts +27 -0
- package/dist/columnExpressions/functions/seq_range.d.ts +36 -0
- package/dist/columnExpressions/functions/struct.d.ts +31 -0
- package/dist/columnExpressions/functions/when.d.ts +36 -6
- package/dist/columnExpressions/index.d.ts +1 -0
- package/dist/columnExpressions/mixins/AggregationExpr.d.ts +334 -0
- package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +609 -0
- package/dist/columnExpressions/mixins/ArrayExpr.d.ts +533 -5
- package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +353 -0
- package/dist/columnExpressions/mixins/LogicalExpr.d.ts +82 -0
- package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +40 -0
- package/dist/columnExpressions/mixins/StringExpr.d.ts +656 -3
- package/dist/columnExpressions/mixins/StructExpr.d.ts +70 -0
- package/dist/columnExpressions/mixins/TemporalExpr.d.ts +530 -4
- package/dist/columnExpressions/mixins/WindowExpr.d.ts +313 -2
- package/dist/columnExpressions/types.d.ts +1 -0
- package/dist/dataframe/dataframe.d.ts +932 -2
- package/dist/dataframe/grouped/grouped.d.ts +41 -6
- package/dist/dataframe/types.d.ts +1 -0
- package/dist/dataframe/utils.d.ts +1 -0
- package/dist/datatypes/types.d.ts +45 -0
- package/dist/exceptions/index.d.ts +23 -0
- package/dist/functions/concat.d.ts +50 -0
- package/dist/functions/read_csv.d.ts +9 -0
- package/dist/functions/read_json.d.ts +7 -2
- package/dist/index.html +17 -0
- package/dist/index.js +5 -5
- package/dist/index.mjs +6 -0
- package/dist/types.d.ts +47 -14
- package/dist/utils/array.d.ts +32 -1
- package/dist/utils/csv.d.ts +1 -0
- package/dist/utils/date.d.ts +10 -27
- package/dist/utils/json.d.ts +1 -0
- package/dist/utils/number.d.ts +1 -0
- package/dist/utils/object.d.ts +1 -0
- package/dist/utils/string.d.ts +12 -0
- package/package.json +18 -4
- package/dist/columnExpressions/mixins/ListExpr.d.ts +0 -39
- package/dist/utils/guards.d.ts +0 -13
- package/dist/utils/list.d.ts +0 -217
package/dist/utils/list.d.ts
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
export type ArrayItemType = "string" | "number" | "boolean" | "bigint" | "object" | "plainObject" | "date" | "any" | "null" | "undefined" | "nullish" | (new (...args: any[]) => any) | ((v: unknown) => boolean);
|
|
2
|
-
export type ArrayCheckMode = "every" | "some";
|
|
3
|
-
export type IsArrayOfTypeOptionsParams = {
|
|
4
|
-
mode?: ArrayCheckMode;
|
|
5
|
-
allowNulls?: boolean;
|
|
6
|
-
allowEmpty?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare function toValidArray<T>(val: T | T[] | null | undefined): T[];
|
|
9
|
-
export declare function toValidStringArray(val: unknown): string[];
|
|
10
|
-
export declare function isArrayOfType(arr: unknown, type: ArrayItemType, { mode, allowNulls, allowEmpty }?: IsArrayOfTypeOptionsParams): boolean;
|
|
11
|
-
export interface SortListOptions {
|
|
12
|
-
descending?: boolean;
|
|
13
|
-
nullsLast?: boolean;
|
|
14
|
-
isAllNumbers?: boolean;
|
|
15
|
-
isAllStrings?: boolean;
|
|
16
|
-
hasNulls?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare function sortList(arr: unknown, options?: SortListOptions): any[];
|
|
19
|
-
export declare function getListStats(arr: unknown): {
|
|
20
|
-
sum: number | null;
|
|
21
|
-
count: number;
|
|
22
|
-
min: any;
|
|
23
|
-
max: any;
|
|
24
|
-
mean: number | null;
|
|
25
|
-
variance: number;
|
|
26
|
-
std: number;
|
|
27
|
-
nullCount: number;
|
|
28
|
-
len: number;
|
|
29
|
-
hasNulls: boolean;
|
|
30
|
-
isNumeric: boolean;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Options configuration for the `getUniqueListStats` utility.
|
|
34
|
-
*/
|
|
35
|
-
export interface UniqueListStatsOptions {
|
|
36
|
-
/**
|
|
37
|
-
* If true, uses strict serialization comparison (via keySelector or toCanonicalString)
|
|
38
|
-
* to group complex nested types (like Arrays, Sets, Maps, and Dates) by value instead of reference.
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
|
-
strict?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Custom function to extract a unique comparison key from each element.
|
|
44
|
-
* If strict is true and no selector is provided, falls back to `toCanonicalString`.
|
|
45
|
-
*/
|
|
46
|
-
keySelector?: (val: any) => any;
|
|
47
|
-
}
|
|
48
|
-
export declare function getUniqueListStats(arr: ArrayLike<any>, { strict, keySelector }?: UniqueListStatsOptions): {
|
|
49
|
-
values: any[];
|
|
50
|
-
count: number;
|
|
51
|
-
frequencies: Map<any, number>;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Options configuration for the `stepSliceList` utility.
|
|
55
|
-
*/
|
|
56
|
-
export interface StepSliceListOptions {
|
|
57
|
-
/**
|
|
58
|
-
* The step size to slice the list by. Cannot be zero.
|
|
59
|
-
* Positive values slice forward (left-to-right), negative values slice backward (right-to-left).
|
|
60
|
-
* @default 1
|
|
61
|
-
*/
|
|
62
|
-
step?: number;
|
|
63
|
-
/**
|
|
64
|
-
* The index to start slicing from (inclusive).
|
|
65
|
-
* Supports negative values to start relative to the end of the array.
|
|
66
|
-
* @default 0
|
|
67
|
-
*/
|
|
68
|
-
offsetStart?: number;
|
|
69
|
-
/**
|
|
70
|
-
* The index to end slicing at (exclusive).
|
|
71
|
-
* Supports negative values to end relative to the end of the array.
|
|
72
|
-
* Defaults to the end of the array (if step > 0) or -1 (if step < 0).
|
|
73
|
-
*/
|
|
74
|
-
offsetEnd?: number;
|
|
75
|
-
/**
|
|
76
|
-
* Caps the maximum number of items gathered in the sliced result list.
|
|
77
|
-
* If specified, the slicing process stops once this limit is reached.
|
|
78
|
-
*/
|
|
79
|
-
maxItemsGathered?: number;
|
|
80
|
-
/**
|
|
81
|
-
* If true, returns null when the starting offset is out of bounds.
|
|
82
|
-
* If false, throws an error when the starting offset is out of bounds.
|
|
83
|
-
* @default true
|
|
84
|
-
*/
|
|
85
|
-
null_on_oob?: boolean;
|
|
86
|
-
}
|
|
87
|
-
export declare function stepSliceList<T>(arr: ArrayLike<T>, { step, offsetStart, offsetEnd, maxItemsGathered, null_on_oob }?: StepSliceListOptions): T[] | null;
|
|
88
|
-
/**
|
|
89
|
-
* Options configuration for the `joinList` utility.
|
|
90
|
-
*/
|
|
91
|
-
export interface JoinListOptions {
|
|
92
|
-
/**
|
|
93
|
-
* If true, nullish elements (null and undefined) are completely ignored during joining.
|
|
94
|
-
* If false (default), nullish elements are serialized as empty strings or custom `nullValue`.
|
|
95
|
-
* @default false
|
|
96
|
-
*/
|
|
97
|
-
ignoreNulls?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Custom string representation for nullish values.
|
|
100
|
-
* Only applied if `ignoreNulls` is false.
|
|
101
|
-
* @default ""
|
|
102
|
-
*/
|
|
103
|
-
nullValue?: string;
|
|
104
|
-
/**
|
|
105
|
-
* Optional prefix string prepended to the final joined result.
|
|
106
|
-
* @default ""
|
|
107
|
-
*/
|
|
108
|
-
prefix?: string;
|
|
109
|
-
/**
|
|
110
|
-
* Optional suffix string appended to the final joined result.
|
|
111
|
-
* @default ""
|
|
112
|
-
*/
|
|
113
|
-
suffix?: string;
|
|
114
|
-
/**
|
|
115
|
-
* Maximum number of list elements to join.
|
|
116
|
-
* If specified, elements beyond this limit are omitted and `truncationMarker` is appended.
|
|
117
|
-
*/
|
|
118
|
-
limit?: number;
|
|
119
|
-
/**
|
|
120
|
-
* Custom placeholder string appended to the joined string when limit truncation occurs.
|
|
121
|
-
* Only applied if `limit` is specified and the list length exceeds it.
|
|
122
|
-
* @default "..."
|
|
123
|
-
*/
|
|
124
|
-
truncationMarker?: string;
|
|
125
|
-
/**
|
|
126
|
-
* Callback function used to format each individual non-null element to a custom string representation.
|
|
127
|
-
*/
|
|
128
|
-
valueFormatter?: (val: any, index: number) => string;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Joins the elements of an array-like structure into a string using a separator.
|
|
132
|
-
* Excludes nullish checks and formats nested arrays cleanly.
|
|
133
|
-
*/
|
|
134
|
-
export declare function joinList(arr: ArrayLike<any>, separator?: string, { ignoreNulls, nullValue, prefix, suffix, limit, truncationMarker, valueFormatter }?: JoinListOptions): string;
|
|
135
|
-
export interface FillSeqBaseOptions {
|
|
136
|
-
/**
|
|
137
|
-
* Type coercion helper applied to each generated value before writing.
|
|
138
|
-
*
|
|
139
|
-
* @param v The newly generated candidate value.
|
|
140
|
-
* @returns The coerced value to write to the array.
|
|
141
|
-
*/
|
|
142
|
-
coerce?: (v: any) => any;
|
|
143
|
-
/**
|
|
144
|
-
* Conditional predicate determining if a value should be replaced at a given index.
|
|
145
|
-
*
|
|
146
|
-
* @param v The original/current value at the target index.
|
|
147
|
-
* @param index The absolute index of the current element.
|
|
148
|
-
* @param array The entire target array.
|
|
149
|
-
* @returns True if the candidate value should overwrite the original value, false otherwise.
|
|
150
|
-
*/
|
|
151
|
-
condition?: (v: any, index: number, array: any[]) => boolean;
|
|
152
|
-
/**
|
|
153
|
-
* If true, iterates and populates in reverse (from startIndex down to endIndex).
|
|
154
|
-
* @default false
|
|
155
|
-
*/
|
|
156
|
-
reverse?: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* The index at which array iteration and writing begins.
|
|
159
|
-
* @default reverse ? length - 1 : 0
|
|
160
|
-
*/
|
|
161
|
-
startIndex?: number;
|
|
162
|
-
/**
|
|
163
|
-
* The exclusive boundary index at which iteration and writing stops.
|
|
164
|
-
* @default reverse ? -1 : length
|
|
165
|
-
*/
|
|
166
|
-
endIndex?: number;
|
|
167
|
-
}
|
|
168
|
-
export interface CumulativeStepContext {
|
|
169
|
-
/** The accumulated value returned by the step function from the previous stepped index. */
|
|
170
|
-
prev: any;
|
|
171
|
-
/** The relative iteration counter of the stepping process (starts at 1). */
|
|
172
|
-
index: number;
|
|
173
|
-
/** The original value at the current index in the target array. */
|
|
174
|
-
originalValue: any;
|
|
175
|
-
/** The absolute index of the current element in the parent array. */
|
|
176
|
-
absoluteIndex: number;
|
|
177
|
-
/** The entire target array being populated/modified. */
|
|
178
|
-
targetArray: any;
|
|
179
|
-
}
|
|
180
|
-
export interface IndependentStepContext {
|
|
181
|
-
/** The relative iteration counter of the generation process (starts at 0). */
|
|
182
|
-
index: number;
|
|
183
|
-
/** The static starting value passed to the sequence generator. */
|
|
184
|
-
initialValue: any;
|
|
185
|
-
/** The original value at the current index in the target array. */
|
|
186
|
-
originalValue: any;
|
|
187
|
-
/** The absolute index of the current element in the parent array. */
|
|
188
|
-
absoluteIndex: number;
|
|
189
|
-
/** The entire target array being populated/modified. */
|
|
190
|
-
targetArray: any;
|
|
191
|
-
}
|
|
192
|
-
export type FillSeqOptions = FillSeqBaseOptions & ({
|
|
193
|
-
mode: "constant";
|
|
194
|
-
step?: never;
|
|
195
|
-
} | {
|
|
196
|
-
mode?: "cumulative";
|
|
197
|
-
step?: number | ((context: CumulativeStepContext) => any);
|
|
198
|
-
} | {
|
|
199
|
-
mode: "independent";
|
|
200
|
-
step?: number | ((context: IndependentStepContext) => any);
|
|
201
|
-
});
|
|
202
|
-
export declare function fillSequence(targetArray: any, initialValue: any, options?: FillSeqOptions): void;
|
|
203
|
-
/**
|
|
204
|
-
* Computes the median of a numeric array, filtering out non-numeric and NaN values.
|
|
205
|
-
* Returns null if no valid numbers remain.
|
|
206
|
-
*/
|
|
207
|
-
export declare function computeMedian(values: ArrayLike<any>): number | null;
|
|
208
|
-
/**
|
|
209
|
-
* Computes the quantile of a numeric array using linear interpolation, filtering out non-numeric and NaN values.
|
|
210
|
-
* q must be in [0, 1]. Returns null if no valid numbers remain or q is out of bounds.
|
|
211
|
-
*/
|
|
212
|
-
export declare function computeQuantile(values: ArrayLike<any>, q: number): number | null;
|
|
213
|
-
/**
|
|
214
|
-
* Computes the mode(s) of an array, filtering out null/undefined values.
|
|
215
|
-
* Returns an array of the most frequent values, sorted, or null if empty/no mode.
|
|
216
|
-
*/
|
|
217
|
-
export declare function computeMode(values: ArrayLike<any>): any[] | null;
|