df-script 1.4.0 → 1.5.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.
Files changed (95) hide show
  1. package/README.md +83 -34
  2. package/dist/api.d.ts +16 -8
  3. package/dist/api.js +11 -3
  4. package/dist/columnExpressions/ColumnExpr.d.ts +26 -364
  5. package/dist/columnExpressions/ColumnExpr.js +199 -3
  6. package/dist/columnExpressions/ExprBase.d.ts +8 -11
  7. package/dist/columnExpressions/ExprBase.js +20 -61
  8. package/dist/columnExpressions/constants.d.ts +2 -0
  9. package/dist/columnExpressions/constants.js +3 -1
  10. package/dist/columnExpressions/functions/coalesce.js +8 -4
  11. package/dist/columnExpressions/functions/element.d.ts +5 -0
  12. package/dist/columnExpressions/functions/element.js +11 -0
  13. package/dist/columnExpressions/functions/implode.d.ts +3 -0
  14. package/dist/columnExpressions/functions/implode.js +7 -0
  15. package/dist/columnExpressions/functions/lit.d.ts +3 -1
  16. package/dist/columnExpressions/functions/lit.js +8 -13
  17. package/dist/columnExpressions/functions/repeat.d.ts +47 -0
  18. package/dist/columnExpressions/functions/repeat.js +131 -0
  19. package/dist/columnExpressions/functions/seq_range.d.ts +31 -0
  20. package/dist/columnExpressions/functions/seq_range.js +91 -0
  21. package/dist/columnExpressions/functions/when.js +8 -4
  22. package/dist/columnExpressions/index.d.ts +5 -2
  23. package/dist/columnExpressions/index.js +5 -48
  24. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +25 -50
  25. package/dist/columnExpressions/mixins/AggregationExpr.js +69 -165
  26. package/dist/columnExpressions/mixins/ArithmeticExpr.d.ts +41 -66
  27. package/dist/columnExpressions/mixins/ArithmeticExpr.js +126 -138
  28. package/dist/columnExpressions/mixins/BooleanExpr.d.ts +40 -0
  29. package/dist/columnExpressions/mixins/BooleanExpr.js +67 -0
  30. package/dist/columnExpressions/mixins/ComparisonExpr.d.ts +31 -60
  31. package/dist/columnExpressions/mixins/ComparisonExpr.js +231 -370
  32. package/dist/columnExpressions/mixins/ListExpr.d.ts +15 -39
  33. package/dist/columnExpressions/mixins/ListExpr.js +124 -148
  34. package/dist/columnExpressions/mixins/LogicalExpr.d.ts +7 -33
  35. package/dist/columnExpressions/mixins/LogicalExpr.js +48 -49
  36. package/dist/columnExpressions/mixins/ManipulationExpr.d.ts +6 -31
  37. package/dist/columnExpressions/mixins/ManipulationExpr.js +61 -25
  38. package/dist/columnExpressions/mixins/NumericExpr.d.ts +92 -0
  39. package/dist/columnExpressions/mixins/NumericExpr.js +259 -0
  40. package/dist/columnExpressions/mixins/StringExpr.d.ts +5 -30
  41. package/dist/columnExpressions/mixins/StringExpr.js +37 -49
  42. package/dist/columnExpressions/mixins/StructExpr.d.ts +16 -0
  43. package/dist/columnExpressions/mixins/StructExpr.js +139 -0
  44. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +4 -30
  45. package/dist/columnExpressions/mixins/TemporalExpr.js +28 -29
  46. package/dist/columnExpressions/mixins/WindowExpr.d.ts +27 -49
  47. package/dist/columnExpressions/mixins/WindowExpr.js +144 -274
  48. package/dist/columnExpressions/utils.d.ts +4 -0
  49. package/dist/columnExpressions/utils.js +45 -0
  50. package/dist/dataframe/constants.d.ts +3 -0
  51. package/dist/dataframe/constants.js +4 -1
  52. package/dist/dataframe/dataframe.d.ts +27 -10
  53. package/dist/dataframe/dataframe.js +461 -220
  54. package/dist/dataframe/grouped/grouped.d.ts +2 -3
  55. package/dist/dataframe/grouped/grouped.js +17 -16
  56. package/dist/dataframe/types.d.ts +65 -1
  57. package/dist/dataframe/utils.d.ts +11 -3
  58. package/dist/dataframe/utils.js +101 -9
  59. package/dist/datatypes/DataType.d.ts +2 -1
  60. package/dist/datatypes/DataType.js +29 -0
  61. package/dist/datatypes/index.d.ts +2 -2
  62. package/dist/datatypes/types.d.ts +37 -36
  63. package/dist/datatypes/types.js +15 -11
  64. package/dist/exceptions/index.d.ts +2 -0
  65. package/dist/exceptions/index.js +4 -1
  66. package/dist/exceptions/utils.d.ts +1 -0
  67. package/dist/exceptions/utils.js +19 -0
  68. package/dist/functions/concat.d.ts +1 -2
  69. package/dist/functions/concat.js +24 -12
  70. package/dist/functions/index.d.ts +3 -1
  71. package/dist/functions/index.js +7 -15
  72. package/dist/functions/read_csv.d.ts +8 -0
  73. package/dist/functions/read_csv.js +53 -0
  74. package/dist/functions/read_json.d.ts +10 -0
  75. package/dist/functions/read_json.js +21 -0
  76. package/dist/functions/transpose.d.ts +7 -0
  77. package/dist/functions/transpose.js +84 -0
  78. package/dist/index.js +6 -1
  79. package/dist/types.d.ts +31 -5
  80. package/dist/utils/csv.d.ts +77 -0
  81. package/dist/utils/csv.js +313 -0
  82. package/dist/utils/date.js +5 -6
  83. package/dist/utils/guards.d.ts +0 -2
  84. package/dist/utils/guards.js +0 -31
  85. package/dist/utils/index.d.ts +2 -0
  86. package/dist/utils/index.js +2 -0
  87. package/dist/utils/json.d.ts +120 -2
  88. package/dist/utils/json.js +204 -20
  89. package/dist/utils/list.d.ts +173 -1
  90. package/dist/utils/list.js +255 -22
  91. package/dist/utils/number.d.ts +61 -28
  92. package/dist/utils/number.js +248 -70
  93. package/dist/utils/string.d.ts +5 -0
  94. package/dist/utils/string.js +89 -0
  95. package/package.json +5 -1
@@ -1,21 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toValidArray = toValidArray;
4
+ exports.toValidStringArray = toValidStringArray;
4
5
  exports.isArrayOfType = isArrayOfType;
5
6
  exports.sortList = sortList;
6
7
  exports.getListStats = getListStats;
8
+ exports.getUniqueListStats = getUniqueListStats;
9
+ exports.stepSliceList = stepSliceList;
10
+ exports.joinList = joinList;
11
+ exports.fillSequence = fillSequence;
7
12
  const guards_1 = require("./guards");
8
13
  const date_1 = require("./date");
9
14
  const number_1 = require("./number");
15
+ const string_1 = require("./string");
10
16
  function toValidArray(val) {
11
17
  if (val == null)
12
18
  return [];
13
19
  if (Array.isArray(val))
14
- return val;
20
+ return [...val];
15
21
  if ((0, guards_1.isTypedArray)(val))
16
22
  return Array.from(val);
17
23
  return [val];
18
24
  }
25
+ function toValidStringArray(val) {
26
+ const arr = toValidArray(val);
27
+ const len = arr.length;
28
+ const res = new Array(len);
29
+ for (let i = 0; i < len; i++) {
30
+ res[i] = String(arr[i]);
31
+ }
32
+ return res;
33
+ }
19
34
  function isArrayOfType(arr, type, { mode = "every", allowNulls = false, allowEmpty = true } = {}) {
20
35
  if (!(0, guards_1.isArrayOrTypedArray)(arr))
21
36
  return false;
@@ -25,32 +40,59 @@ function isArrayOfType(arr, type, { mode = "every", allowNulls = false, allowEmp
25
40
  return false;
26
41
  return mode === "every";
27
42
  }
28
- const check = (v) => {
29
- if (v == null)
30
- return allowNulls;
31
- if (typeof type === "function") {
32
- return (0, guards_1.isClass)(type) ? v instanceof type : type(v);
33
- }
34
- if (type === "date")
35
- return (0, date_1.isValidDateObj)(v);
36
- if (type === "object")
37
- return (0, guards_1.isObj)(v);
38
- if (type === "plainObject")
39
- return (0, guards_1.isPlainObj)(v);
40
- if (type === "number")
41
- return (0, number_1.isValidNumber)(v);
42
- return typeof v === type;
43
- };
43
+ const list = arr;
44
+ let check;
45
+ if (typeof type === "function") {
46
+ const isC = (0, guards_1.isClass)(type);
47
+ check = isC
48
+ ? (v) => v instanceof type
49
+ : type;
50
+ }
51
+ else {
52
+ switch (type) {
53
+ case "null":
54
+ check = (v) => v === null;
55
+ break;
56
+ case "undefined":
57
+ check = (v) => v === undefined;
58
+ break;
59
+ case "nullish":
60
+ check = (v) => v == null;
61
+ break;
62
+ case "any":
63
+ check = () => true;
64
+ break;
65
+ case "date":
66
+ check = date_1.isValidDateObj;
67
+ break;
68
+ case "object":
69
+ check = guards_1.isObj;
70
+ break;
71
+ case "plainObject":
72
+ check = guards_1.isPlainObj;
73
+ break;
74
+ case "number":
75
+ check = number_1.isValidNumber;
76
+ break;
77
+ default:
78
+ check = (v) => typeof v === type;
79
+ break;
80
+ }
81
+ }
82
+ if (allowNulls) {
83
+ const baseCheck = check;
84
+ check = (v) => v == null || baseCheck(v);
85
+ }
44
86
  if (mode === "every") {
45
87
  for (let i = 0; i < len; i++) {
46
- if (!check(arr[i]))
88
+ if (!check(list[i]))
47
89
  return false;
48
90
  }
49
91
  return true;
50
92
  }
51
93
  else {
52
94
  for (let i = 0; i < len; i++) {
53
- if (check(arr[i]))
95
+ if (check(list[i]))
54
96
  return true;
55
97
  }
56
98
  return false;
@@ -89,6 +131,7 @@ function getListStats(arr) {
89
131
  let count = 0;
90
132
  let nullCount = 0;
91
133
  let total = 0;
134
+ let sumCompensation = 0;
92
135
  let mean = 0;
93
136
  let M2 = 0;
94
137
  for (let i = 0; i < len; i++) {
@@ -103,7 +146,15 @@ function getListStats(arr) {
103
146
  maxVal = val;
104
147
  const n = (0, number_1.toValidNumber)(val);
105
148
  if (n !== null) {
106
- total += n;
149
+ // Neumaier sum
150
+ const t = total + n;
151
+ if (Math.abs(total) >= Math.abs(n)) {
152
+ sumCompensation += (total - t) + n;
153
+ }
154
+ else {
155
+ sumCompensation += (n - t) + total;
156
+ }
157
+ total = t;
107
158
  count++;
108
159
  const delta = n - mean;
109
160
  mean += delta / count;
@@ -113,11 +164,11 @@ function getListStats(arr) {
113
164
  }
114
165
  const variance = count > 1 ? M2 / (count - 1) : 0;
115
166
  return {
116
- sum: count > 0 ? total : null,
167
+ sum: count > 0 ? total + sumCompensation : null,
117
168
  count,
118
169
  min: minVal,
119
170
  max: maxVal,
120
- mean: count > 0 ? total / count : null,
171
+ mean: count > 0 ? (total + sumCompensation) / count : null,
121
172
  variance,
122
173
  std: Math.sqrt(variance),
123
174
  nullCount,
@@ -126,3 +177,185 @@ function getListStats(arr) {
126
177
  isNumeric: count > 0 && count === (len - nullCount)
127
178
  };
128
179
  }
180
+ function getUniqueListStats(arr, { strict = false, keySelector } = {}) {
181
+ const list = Array.from(arr);
182
+ const frequencies = new Map();
183
+ if (strict) {
184
+ const selector = keySelector ?? string_1.toCanonicalString;
185
+ const seen = new Map();
186
+ const len = list.length;
187
+ for (let i = 0; i < len; i++) {
188
+ const val = list[i];
189
+ const key = selector(val);
190
+ const entry = seen.get(key);
191
+ if (entry === undefined) {
192
+ seen.set(key, { val, count: 1 });
193
+ }
194
+ else {
195
+ entry.count++;
196
+ }
197
+ }
198
+ const values = [];
199
+ for (const entry of seen.values()) {
200
+ values.push(entry.val);
201
+ }
202
+ for (let i = 0; i < len; i++) {
203
+ const val = list[i];
204
+ const key = selector(val);
205
+ const entry = seen.get(key);
206
+ frequencies.set(val, entry.count);
207
+ }
208
+ return {
209
+ values,
210
+ count: values.length,
211
+ frequencies
212
+ };
213
+ }
214
+ const len = list.length;
215
+ for (let i = 0; i < len; i++) {
216
+ const val = list[i];
217
+ frequencies.set(val, (frequencies.get(val) ?? 0) + 1);
218
+ }
219
+ return {
220
+ values: Array.from(frequencies.keys()),
221
+ count: frequencies.size,
222
+ frequencies
223
+ };
224
+ }
225
+ function stepSliceList(arr, { step = 1, offsetStart = 0, offsetEnd, maxItemsGathered, null_on_oob = true } = {}) {
226
+ if (arr == null) {
227
+ return null;
228
+ }
229
+ if (maxItemsGathered !== undefined && maxItemsGathered <= 0) {
230
+ return [];
231
+ }
232
+ if (step === 0) {
233
+ throw new Error("Step size step cannot be zero");
234
+ }
235
+ const len = arr.length;
236
+ const isOob = len === 0
237
+ ? (offsetStart !== 0)
238
+ : (offsetStart >= len || offsetStart < -len);
239
+ if (isOob) {
240
+ if (!null_on_oob) {
241
+ throw new Error(`Start offset ${offsetStart} is out of bounds for list of length ${len}`);
242
+ }
243
+ return null;
244
+ }
245
+ const start = offsetStart < 0 ? len + offsetStart : offsetStart;
246
+ const end = offsetEnd !== undefined
247
+ ? (offsetEnd < 0 ? len + offsetEnd : offsetEnd)
248
+ : (step > 0 ? len : -1);
249
+ const res = [];
250
+ if (step > 0) {
251
+ for (let i = start; i < end && i < len; i += step) {
252
+ if (i >= 0) {
253
+ res.push(arr[i]);
254
+ if (maxItemsGathered !== undefined && res.length >= maxItemsGathered) {
255
+ break;
256
+ }
257
+ }
258
+ }
259
+ }
260
+ else {
261
+ for (let i = start; i > end && i >= 0; i += step) {
262
+ if (i < len) {
263
+ res.push(arr[i]);
264
+ if (maxItemsGathered !== undefined && res.length >= maxItemsGathered) {
265
+ break;
266
+ }
267
+ }
268
+ }
269
+ }
270
+ return res;
271
+ }
272
+ /**
273
+ * Joins the elements of an array-like structure into a string using a separator.
274
+ * Excludes nullish checks and formats nested arrays cleanly.
275
+ */
276
+ function joinList(arr, separator = ",", { ignoreNulls = false, nullValue = "", prefix = "", suffix = "", limit, truncationMarker = "...", valueFormatter } = {}) {
277
+ const len = arr.length;
278
+ const strList = [];
279
+ const maxLimit = limit !== undefined ? Math.max(0, limit) : len;
280
+ let truncated = false;
281
+ for (let i = 0; i < len; i++) {
282
+ if (strList.length >= maxLimit) {
283
+ truncated = true;
284
+ break;
285
+ }
286
+ const x = arr[i];
287
+ if (x != null) {
288
+ strList.push(valueFormatter ? valueFormatter(x, i) : String(x));
289
+ }
290
+ else if (!ignoreNulls) {
291
+ strList.push(nullValue);
292
+ }
293
+ }
294
+ return prefix + strList.join(separator) + (truncated ? truncationMarker : "") + suffix;
295
+ }
296
+ function fillSequence(targetArray, initialValue, options = {}) {
297
+ const len = targetArray.length;
298
+ const { mode = "cumulative", step = 1, coerce = (v) => v, condition, reverse = false, startIndex = reverse ? len - 1 : 0, endIndex = reverse ? -1 : len } = options;
299
+ const increment = reverse ? -1 : 1;
300
+ const start = startIndex;
301
+ const end = endIndex;
302
+ const writeVal = (idx, val) => {
303
+ if (!condition || condition(targetArray[idx], idx, targetArray)) {
304
+ targetArray[idx] = coerce(val);
305
+ }
306
+ };
307
+ if (mode === "constant") {
308
+ const finalVal = coerce(initialValue);
309
+ for (let i = start; reverse ? i > end : i < end; i += increment) {
310
+ writeVal(i, finalVal);
311
+ }
312
+ }
313
+ else if (mode === "independent") {
314
+ if (typeof step === "function") {
315
+ let relativeIdx = 0;
316
+ for (let i = start; reverse ? i > end : i < end; i += increment) {
317
+ writeVal(i, step({
318
+ index: relativeIdx,
319
+ initialValue,
320
+ originalValue: targetArray[i],
321
+ absoluteIndex: i,
322
+ targetArray
323
+ }));
324
+ relativeIdx++;
325
+ }
326
+ }
327
+ else {
328
+ for (let i = start; reverse ? i > end : i < end; i += increment) {
329
+ writeVal(i, initialValue + i * step);
330
+ }
331
+ }
332
+ }
333
+ else {
334
+ // cumulative mode
335
+ let current = initialValue;
336
+ let isFirst = true;
337
+ let relativeIdx = 0;
338
+ for (let i = start; reverse ? i > end : i < end; i += increment) {
339
+ if (isFirst) {
340
+ writeVal(i, current);
341
+ isFirst = false;
342
+ }
343
+ else {
344
+ if (typeof step === "function") {
345
+ current = step({
346
+ prev: current,
347
+ index: relativeIdx,
348
+ originalValue: targetArray[i],
349
+ absoluteIndex: i,
350
+ targetArray
351
+ });
352
+ }
353
+ else {
354
+ current = current + step;
355
+ }
356
+ writeVal(i, current);
357
+ }
358
+ relativeIdx++;
359
+ }
360
+ }
361
+ }
@@ -1,24 +1,32 @@
1
- export declare function isValidNumber(v: unknown): v is number;
2
- export declare function toValidNumber(v: unknown): number | null;
3
- export declare function clamp<T extends number | bigint>(opts: {
4
- val: T;
5
- min: T;
6
- max: T;
7
- }): T;
1
+ export interface NumericValidationOptions {
2
+ allowNonFiniteNumbers?: boolean;
3
+ }
4
+ export declare function isValidNumber(v: unknown, options?: NumericValidationOptions): v is number;
5
+ export declare function toValidNumber(v: unknown, options?: NumericValidationOptions): number | null;
6
+ export interface NumericFormatOptions extends Intl.NumberFormatOptions {
7
+ /** BCP 47 language tag (e.g., 'en-US' for dot, 'de-DE' for comma). Defaults to 'en-US'. */
8
+ locale?: string;
9
+ /** If true, formats negative numbers in parentheses e.g. (1.23) instead of -1.23. */
10
+ accountingNegatives?: boolean;
11
+ /** Fallback string if the value cannot be parsed into a formatable number. */
12
+ fallback?: string;
13
+ }
14
+ /**
15
+ * Formats any numeric value (number, bigint, numeric string, Date, etc.) for output,
16
+ * handling NaN, Infinity, scientific notation, precision, and accounting formats.
17
+ */
18
+ export declare function formatNumber({ locale, accountingNegatives, fallback, ...intlOpts }?: NumericFormatOptions): (value: unknown) => string;
8
19
  export type FloatPrecision = "Float32" | "Float64";
9
- export declare const FLOAT_32_BOUNDARY = 3.4028234663852886e+38;
10
- export declare const FLOAT_RANGES: {
11
- readonly Float32: {
12
- readonly min: number;
13
- readonly max: 3.4028234663852886e+38;
14
- };
15
- readonly Float64: {
16
- readonly min: number;
17
- readonly max: number;
18
- };
19
- };
20
- export declare function isValidFloat(v: unknown, precision?: FloatPrecision): boolean;
21
- export declare function toValidFloat(v: unknown, precision?: FloatPrecision): number | null;
20
+ export interface FloatOptions extends NumericValidationOptions {
21
+ floatPrecision?: FloatPrecision;
22
+ /**
23
+ * When true, explicitly accepts scientific notation strings (e.g. "1.23e+4").
24
+ * The result is still validated against the precision range.
25
+ */
26
+ floatScientific?: boolean;
27
+ }
28
+ export declare function isValidFloat(v: unknown, { floatPrecision, allowNonFiniteNumbers, floatScientific }?: FloatOptions): boolean;
29
+ export declare function toValidFloat(v: unknown, { floatPrecision, allowNonFiniteNumbers, floatScientific }?: FloatOptions): number | null;
22
30
  export declare const INT_RANGES: {
23
31
  readonly Int8: {
24
32
  readonly min: -128;
@@ -50,6 +58,13 @@ export type IntRange = {
50
58
  min: number;
51
59
  max: number;
52
60
  } | IntRangeType;
61
+ export type IntCoerceType = "round" | "floor" | "ceil" | "truncate";
62
+ export interface IntOptions {
63
+ range?: IntRange;
64
+ coerce?: IntCoerceType;
65
+ }
66
+ export declare function isValidInt(v: unknown, range?: IntRange): v is number;
67
+ export declare function toValidInt(v: unknown, { range, coerce }?: IntOptions): number | null;
53
68
  export declare const BIGINT_RANGES: {
54
69
  readonly Int64: {
55
70
  readonly min: -9223372036854775808n;
@@ -65,22 +80,40 @@ export type BigIntRange = {
65
80
  min: bigint;
66
81
  max: bigint;
67
82
  } | BigIntRangeType;
68
- export type IntCoerceType = "round" | "floor" | "ceil" | "truncate";
69
- export interface IntOptions {
70
- coerce?: IntCoerceType;
83
+ export interface BigIntOptions {
84
+ range?: BigIntRange;
85
+ truncate?: boolean;
71
86
  }
72
- export declare function isValidInt(v: unknown, range?: IntRange): v is number;
73
87
  export declare function isValidBigInt(v: unknown, range?: BigIntRange): v is bigint;
74
- export declare function toValidInt(v: unknown, range?: IntRange, opts?: IntOptions): number | null;
75
- export declare function toValidBigInt(v: unknown, range?: BigIntRange): bigint | null;
88
+ export declare function toValidBigInt(v: unknown, { range, truncate }?: BigIntOptions): bigint | null;
76
89
  export interface DecimalOptions {
77
90
  precision?: number;
78
91
  scale?: number;
79
92
  }
80
- export declare function isValidDecimal(v: unknown, opts?: DecimalOptions): boolean;
81
- export declare function toValidDecimal(v: unknown, opts?: DecimalOptions): number | null;
93
+ export declare function isValidDecimal(v: unknown, { precision, scale }?: DecimalOptions): boolean;
94
+ export declare function toValidDecimal(v: unknown, { precision, scale }?: DecimalOptions): number | null;
95
+ export declare function clamp<T extends number | bigint>(val: T, { min, max, safe }?: {
96
+ min?: T | null;
97
+ max?: T | null;
98
+ safe?: boolean;
99
+ }): T;
82
100
  /**
83
101
  * Creates a seedable pseudo-random number generator using the Mulberry32 PRNG algorithm.
84
102
  * Returns a function that generates a pseudo-random float in the range [0, 1).
85
103
  */
86
104
  export declare function mulberry32(seed: number): () => number;
105
+ /**
106
+ * Computes the median of a numeric array, filtering out non-numeric and NaN values.
107
+ * Returns null if no valid numbers remain.
108
+ */
109
+ export declare function computeMedian(values: ArrayLike<any>): number | null;
110
+ /**
111
+ * Computes the quantile of a numeric array using linear interpolation, filtering out non-numeric and NaN values.
112
+ * q must be in [0, 1]. Returns null if no valid numbers remain or q is out of bounds.
113
+ */
114
+ export declare function computeQuantile(values: ArrayLike<any>, q: number): number | null;
115
+ /**
116
+ * Computes the mode(s) of an array, filtering out null/undefined values.
117
+ * Returns an array of the most frequent values, sorted, or null if empty/no mode.
118
+ */
119
+ export declare function computeMode(values: ArrayLike<any>): any[] | null;