@tolki/data 0.0.0-stage → 0.0.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/dist/data.d.ts ADDED
@@ -0,0 +1,1636 @@
1
+ import { add as arrAdd, arrayItem, boolean as arrBoolean, chunk as arrChunk, chunkBy as arrChunkBy, chunkWhile as arrChunkWhile, collapse as arrCollapse, combine as arrCombine, contains as arrContains, containsStrict as arrContainsStrict, crossJoin as arrCrossJoin, diff as arrDiff, diffAssoc as arrDiffAssoc, diffAssocUsing as arrDiffAssocUsing, diffKeys as arrDiffKeys, diffKeysUsing as arrDiffKeysUsing, diffUsing as arrDiffUsing, divide as arrDivide, dot as arrDot, every as arrEvery, except as arrExcept, exceptValues as arrExceptValues, exists as arrExists, filter as arrFilter, first as arrFirst, flatten as arrFlatten, flip as arrFlip, float as arrFloat, forget as arrForget, from as arrFrom, get as arrGet, has as arrHas, hasAll as arrHasAll, hasAny as arrHasAny, integer as arrInteger, intersect as arrIntersect, intersectAssoc as arrIntersectAssoc, intersectAssocUsing as arrIntersectAssocUsing, intersectByKeys as arrIntersectByKeys, intersectUsing as arrIntersectUsing, join as arrJoin, keyBy as arrKeyBy, keys as arrKeys, last as arrLast, map as arrMap, mapSpread as arrMapSpread, only as arrOnly, onlyValues as arrOnlyValues, pad as arrPad, partition as arrPartition, pluck as arrPluck, pop as arrPop, prepend as arrPrepend, prependKeysWith as arrPrependKeysWith, pull as arrPull, push as arrPush, query as arrQuery, random as arrRandom, reject as arrReject, reverse as arrReverse, select as arrSelect, set as arrSet, shift as arrShift, shuffle as arrShuffle, skipUntil as arrSkipUntil, skipWhile as arrSkipWhile, slice as arrSlice, sole as arrSole, some as arrSome, sort as arrSort, sortDesc as arrSortDesc, sortRecursive as arrSortRecursive, sortRecursiveDesc as arrSortRecursiveDesc, splice as arrSplice, string as arrString, take as arrTake, takeUntil as arrTakeUntil, takeWhile as arrTakeWhile, toCssClasses as arrToCssClasses, toCssStyles as arrToCssStyles, undot as arrUndot, unshift as arrUnshift, values as arrValues, where as arrWhere, whereNotNull as arrWhereNotNull } from '@tolki/arr';
2
+ import { add as objAdd, boolean as objBoolean, chunk as objChunk, chunkBy as objChunkBy, chunkWhile as objChunkWhile, collapse as objCollapse, combine as objCombine, contains as objContains, containsStrict as objContainsStrict, crossJoin as objCrossJoin, diff as objDiff, diffAssoc as objDiffAssoc, diffAssocUsing as objDiffAssocUsing, diffKeys as objDiffKeys, diffKeysUsing as objDiffKeysUsing, diffUsing as objDiffUsing, divide as objDivide, dot as objDot, every as objEvery, except as objExcept, exceptValues as objExceptValues, exists as objExists, filter as objFilter, first as objFirst, flatten as objFlatten, flip as objFlip, float as objFloat, forget as objForget, from as objFrom, get as objGet, has as objHas, hasAll as objHasAll, hasAny as objHasAny, integer as objInteger, intersect as objIntersect, intersectAssoc as objIntersectAssoc, intersectAssocUsing as objIntersectAssocUsing, intersectByKeys as objIntersectByKeys, intersectUsing as objIntersectUsing, join as objJoin, keyBy as objKeyBy, keys as objKeys, last as objLast, map as objMap, mapSpread as objMapSpread, objectItem, only as objOnly, onlyValues as objOnlyValues, pad as objPad, partition as objPartition, pluck as objPluck, pop as objPop, prepend as objPrepend, prependKeysWith as objPrependKeysWith, pull as objPull, push as objPush, query as objQuery, random as objRandom, reject as objReject, replace as objReplace, replaceRecursive as objReplaceRecursive, reverse as objReverse, select as objSelect, set as objSet, shift as objShift, shuffle as objShuffle, skipUntil as objSkipUntil, skipWhile as objSkipWhile, slice as objSlice, sole as objSole, some as objSome, sort as objSort, sortDesc as objSortDesc, sortRecursive as objSortRecursive, sortRecursiveDesc as objSortRecursiveDesc, splice as objSplice, string as objString, take as objTake, takeUntil as objTakeUntil, takeWhile as objTakeWhile, toCssClasses as objToCssClasses, toCssStyles as objToCssStyles, undot as objUndot, unshift as objUnshift, values as objValues, where as objWhere, whereNotNull as objWhereNotNull } from '@tolki/obj';
3
+ import { ArrayItems, DataItems, MapData, MapEntryKey, MapEntryValue, PathKey, UndotArrayKey, UndotValue, PathKeys, SortSpec, CaseValue, DefineEnumResult } from '@tolki/types';
4
+ /** What `listWhenIndexed` can answer: the delegate's own record, or that record's values. */
5
+ type ListWhenIndexed<TRecord> = TRecord | TRecord[keyof TRecord][];
6
+ /** A read-only list resolves to `unknown[]`, which it is not assignable to, so `DataAdd` rejects it. */
7
+ type MutableBacking<T> = T extends readonly unknown[] ? unknown[] : unknown;
8
+ /** The backings `dispatch` wraps into a one-element list: everything that is not an object. */
9
+ type NonObjectBacking = string | number | bigint | boolean | symbol | null | undefined;
10
+ /**
11
+ * `dataAdd`'s rows, each answering with its delegate's own return type.
12
+ *
13
+ * One shape is turned away: a backing the compiler has **not narrowed** (`unknown`), which no
14
+ * typed row can claim. Relaxing that has to be a deliberate widening, not a side effect.
15
+ *
16
+ * A read-only list is accepted, and answers `arr.add`'s own row: `arr.add` copies along the
17
+ * written path instead of writing through, so the read-only rejection was only ever a shape of
18
+ * `MutableBacking`, which now guards the `unknown` row alone.
19
+ *
20
+ * Every other backing every sibling write helper takes is accepted here: a Map, a Set, a list, a
21
+ * record, an interface, a class instance, and a scalar, string or nullish value.
22
+ */
23
+ interface DataAdd {
24
+ (data: ReadonlyMap<PropertyKey, unknown>, key: PathKey, value: unknown): ReturnType<typeof objAdd>;
25
+ (data: NonObjectBacking, key: PathKey, value: unknown): ReturnType<typeof objAdd>;
26
+ (data: ReadonlySet<unknown>, key: PathKey, value: unknown): ReturnType<typeof objAdd>;
27
+ <TValue, TAddValue>(data: readonly TValue[], key: PathKey, value: TAddValue): ReturnType<typeof arrAdd<TValue, TAddValue>>;
28
+ <TData extends object, TKey extends string | number, TAddValue>(data: TData & MutableBacking<TData>, key: TKey, value: TAddValue): ReturnType<typeof objAdd<TData, TKey, TAddValue>>;
29
+ }
30
+ /**
31
+ * Add an element to data.
32
+ *
33
+ * @param data - The data to add to. A backing the compiler has not narrowed is rejected; see `DataAdd`
34
+ * @param key - The key to add at
35
+ * @param value - The value to add
36
+ * @returns New data with the element added, matching the delegate's own result
37
+ *
38
+ * @example
39
+ *
40
+ * dataAdd([1, 2], 2, 3); -> [1, 2, 3]
41
+ * dataAdd({a: 1}, 'b', 2); -> {a: 1, b: 2}
42
+ */
43
+ export declare const dataAdd: DataAdd;
44
+ /**
45
+ * Get an item from data or return default value.
46
+ *
47
+ * @param data - The data to get from
48
+ * @param key - The key to get
49
+ * @param defaultValue - Default value if key doesn't exist
50
+ * @returns The item value or default
51
+ *
52
+ * @example
53
+ *
54
+ * dataItem([['a', 'b'], ['c', 'd']], 0); -> ['a', 'b']
55
+ * dataItem({items: {x: 1, y: 2}}, 'items'); -> {x: 1, y: 2}
56
+ */
57
+ export declare const dataItem: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, defaultValue?: unknown) => Record<string, unknown>) & typeof arrayItem & typeof objectItem;
58
+ /**
59
+ * Get a boolean value from data.
60
+ *
61
+ * @param data - The data to get from
62
+ * @param key - The key to get
63
+ * @param defaultValue - Default boolean value, `null` when omitted, as in PHP
64
+ * @returns Boolean value or default
65
+ *
66
+ * @example
67
+ *
68
+ * dataBoolean([true, false], 0, false); -> true
69
+ * dataBoolean({active: true}, 'active', false); -> true
70
+ */
71
+ export declare const dataBoolean: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, defaultValue?: (boolean | (() => boolean)) | null | undefined) => boolean) & typeof arrBoolean & typeof objBoolean;
72
+ /**
73
+ * Chunk the data into chunks of the given size.
74
+ *
75
+ * A Map is chunked in its insertion order, so each chunk holds the entries PHP's would.
76
+ *
77
+ * @param data - The data to chunk
78
+ * @param size - The size of each chunk
79
+ * @param preserveKeys - Whether to keep each entry's own key instead of reindexing the chunk.
80
+ * The default follows the backing: `false` for a list, whose keys are already just indices,
81
+ * and `true` for a keyed backing, whose keys carry meaning.
82
+ * @returns Chunked data
83
+ *
84
+ * @example
85
+ *
86
+ * dataChunk([1, 2, 3], 2); -> [[1, 2], [3]]
87
+ * dataChunk(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 2, false); -> { 0: { 0: 'c', 1: 'a' }, 1: { 0: 'b' } }
88
+ */
89
+ export declare const dataChunk: ((data: ReadonlyMap<unknown, unknown>, size: number, preserveKeys?: boolean | undefined) => Record<number, Record<string, unknown>>) & typeof arrChunk & typeof objChunk;
90
+ /**
91
+ * Chunk the data into chunks with a callback.
92
+ *
93
+ * A Map is walked in its insertion order, so the callback sees its entries in PHP's order.
94
+ *
95
+ * @param data - The data to chunk
96
+ * @param callback - Receives the value, its key and the chunk built so far; return true to keep appending
97
+ * @returns Chunked data
98
+ *
99
+ * @remarks A Map backing widens the callback's value parameter to `unknown`. Its chunk is a plain object, integer keys
100
+ * first, so `Object.values(chunk).at(-1)` is PHP's `$chunk->last()` only when the key added last is also listed last.
101
+ *
102
+ * @example
103
+ *
104
+ * dataChunkWhile([1, 1, 2], (value, index, chunk) => chunk.at(-1) === value); -> [[1, 1], [2]]
105
+ * dataChunkWhile({ a: 1, b: 1, c: 2 }, (value, key, chunk) => Object.values(chunk).at(-1) === value);
106
+ * -> { 0: { a: 1, b: 1 }, 1: { c: 2 } }
107
+ * dataChunkWhile(new Map([[2, 'c'], [0, 'a']]), () => false); -> { 0: { 2: 'c' }, 1: { 0: 'a' } }
108
+ */
109
+ export declare const dataChunkWhile: ((data: ReadonlyMap<unknown, unknown>, callback: (value: unknown, key: string | number, chunk: Record<string, unknown>) => unknown) => Record<number, Record<string, unknown>>) & typeof arrChunkWhile & typeof objChunkWhile;
110
+ /**
111
+ * Chunk the data into chunks by comparing adjacent values using the given key or callback.
112
+ *
113
+ * A Map is walked in its insertion order, so the items compared as adjacent are PHP's.
114
+ *
115
+ * @param data - The data to chunk
116
+ * @param key - A path into each item, or a callback receiving the value and its key
117
+ * @returns Chunked data
118
+ *
119
+ * @example
120
+ *
121
+ * dataChunkBy([1, 1, 2], (value) => value); -> [[1, 1], [2]]
122
+ * dataChunkBy({ a: 1, b: 1, c: 2 }, (value) => value); -> { 0: { a: 1, b: 1 }, 1: { c: 2 } }
123
+ * dataChunkBy(new Map([[2, 1], [0, 1], [1, 2]]), (value) => value); -> { 0: { 0: 1, 2: 1 }, 1: { 1: 2 } }
124
+ */
125
+ export declare const dataChunkBy: ((data: ReadonlyMap<unknown, unknown>, key: PathKey | ((value: unknown, key: string | number) => unknown)) => Record<number, Record<string, unknown>>) & typeof arrChunkBy & typeof objChunkBy;
126
+ /**
127
+ * Collapse nested data into a single level.
128
+ *
129
+ * A Map's items are merged in its insertion order, so the integer keys are renumbered and
130
+ * the last string key wins as PHP's `array_merge` does. A Map among the items is skipped.
131
+ *
132
+ * @param data - The data to collapse
133
+ * @returns Collapsed data
134
+ *
135
+ * @example
136
+ *
137
+ * dataCollapse([[1, 2], [3, 4]]); -> [1, 2, 3, 4]
138
+ * dataCollapse({a: {x: 1, y: 2}, b: {z: 3}}); -> {x: 1, y: 2, z: 3}
139
+ * dataCollapse(new Map([[2, ['c']], [0, ['a']]])); -> {0: 'c', 1: 'a'}
140
+ */
141
+ export declare const dataCollapse: ((data: ReadonlyMap<unknown, unknown>) => Record<string | number, unknown>) & typeof arrCollapse & typeof objCollapse;
142
+ /** The value each delegate answers with for the call `dataCombine` actually makes it. */
143
+ type ArrCombineRow<TKeys, TValues> = ReturnType<typeof arrCombine<TKeys, TValues>>;
144
+ /** obj is handed the backing's VALUES, never the backing, so its row is keyed on `TKeys[]`. */
145
+ type ObjCombineRow<TKeys, TValues> = ReturnType<typeof objCombine<TKeys[], DataItems<TValues>>>;
146
+ /**
147
+ * `dataCombine`'s keys backing. `undefined` is excluded: `toPositionalBacking` keeps it as a
148
+ * one-element list — the difference from `streamPositionalData` that `dispatch.spec` pins — so
149
+ * `array_combine` would reject every values set but a one-element one.
150
+ */
151
+ type CombineKeysBacking = string | number | bigint | boolean | symbol | null;
152
+ /**
153
+ * `dataUndot`'s positional backings — every shape `isKeyedData` sends to `Arr.undot`.
154
+ * `undefined` belongs here too: `toPositionalBacking` keeps it as a one-element list.
155
+ */
156
+ type UndotPositionalBacking = CombineKeysBacking | undefined;
157
+ /**
158
+ * Combine two data sets: the first set's values become the keys, the second set's values the values.
159
+ * Either set may be a list or an object, as `array_combine` takes any two arrays.
160
+ *
161
+ * A Map and a record go to `obj.combine`; a list, a Set, a generator and a scalar go to
162
+ * `arr.combine`, which is where `isKeyedData` sends each of them at runtime.
163
+ *
164
+ * @param itemsA - The first data set
165
+ * @param itemsB - The second data set
166
+ * @returns Combined data set
167
+ *
168
+ * @example
169
+ *
170
+ * dataCombine(['a', 'b'], [1, 2]); -> {a: 1, b: 2}
171
+ * dataCombine(new Map([[2, 'c'], [0, 'a']]), ['x', 'y']); -> {c: 'x', a: 'y'}
172
+ */
173
+ export declare function dataCombine<TKeys, TValues>(itemsA: ReadonlyMap<PropertyKey, TKeys>, itemsB: DataItems<TValues>): ObjCombineRow<TKeys, TValues>;
174
+ export declare function dataCombine<TKeys, TValues>(itemsA: TKeys[], itemsB: DataItems<TValues>): ArrCombineRow<TKeys, TValues>;
175
+ export declare function dataCombine<TKeys, TValues>(itemsA: Record<PropertyKey, TKeys>, itemsB: DataItems<TValues>): ObjCombineRow<TKeys, TValues>;
176
+ export declare function dataCombine<TKeys, TValues>(itemsA: Iterable<TKeys> | CombineKeysBacking, itemsB: DataItems<TValues>): ArrCombineRow<TKeys, TValues>;
177
+ /**
178
+ * Count the number of items in data.
179
+ *
180
+ * @param data - the data to count
181
+ * @returns The count of items in the object or array
182
+ *
183
+ * @example
184
+ *
185
+ * dataCount([1, 2, 3]); -> 3
186
+ * dataCount({a: 1, b: 2}); -> 2
187
+ */
188
+ export declare function dataCount<TValue, TKey extends PropertyKey = PropertyKey>(data: DataItems<TValue, TKey>): number;
189
+ /**
190
+ * Cross join data with other data.
191
+ *
192
+ * When `data` is keyed, every argument is read by key, a Map's keys as dimensions in its insertion order; each row
193
+ * keeps its keys where PHP's spread renumbers integer ones `0..n-1`. When `data` is a list, every argument is one
194
+ * dimension, so a later Map or record gives its values, not its keys.
195
+ *
196
+ * @param data - The data to cross join
197
+ * @param others - Other data to join with
198
+ * @returns Cross joined data
199
+ *
200
+ * @example
201
+ *
202
+ * dataCrossJoin([1, 2], [3, 4]); -> [[1, 3], [1, 4], [2, 3], [2, 4]]
203
+ * dataCrossJoin(new Map([['b', [1, 2]]]), new Map([['a', ['x']]])); -> [{b: 1, a: 'x'}, {b: 2, a: 'x'}]
204
+ * dataCrossJoin([1, 2], new Map([['a', ['x', 'y']]])); -> [[1, ['x', 'y']], [2, ['x', 'y']]]
205
+ */
206
+ export declare const dataCrossJoin: ((data: ReadonlyMap<unknown, unknown>, ...rest: object[]) => {}[]) & typeof arrCrossJoin & typeof objCrossJoin;
207
+ /**
208
+ * Divide data into keys and values.
209
+ *
210
+ * @param data - The data to divide
211
+ * @returns Array with keys and values, matching the delegate's own result
212
+ *
213
+ * @remarks JS-only: a JS object hoists integer-like keys ahead of string ones, so a mixed-key
214
+ * record divides into a different PAIR ORDER than PHP's, though the key types still match.
215
+ * A Map keeps its insertion order, so it divides in PHP's order.
216
+ *
217
+ * @example
218
+ *
219
+ * dataDivide([1, 2, 3]); -> [[0, 1, 2], [1, 2, 3]]
220
+ * dataDivide({a: 1, b: 2}); -> [['a', 'b'], [1, 2]]
221
+ * dataDivide(new Map([['x', 1], [0, 2]])); -> [['x', 0], [1, 2]]
222
+ */
223
+ export declare const dataDivide: ((data: ReadonlyMap<unknown, unknown>) => [(string | number)[], unknown[]]) & typeof arrDivide & typeof objDivide;
224
+ /**
225
+ * Convert data to dot notation.
226
+ *
227
+ * A Map, at the root or nested, is flattened in its insertion order. The result is a plain object, so the integer-like
228
+ * keys an empty or all-digit prefix can leave are listed first, ascending, not in PHP's order.
229
+ *
230
+ * @param data - The data to convert
231
+ * @param prepend - String to prepend to keys
232
+ * @param depth - Maximum depth to flatten. Defaults to Infinity.
233
+ * @returns Data in dot notation, matching the delegate's own result
234
+ *
235
+ * @example
236
+ *
237
+ * dataDot({a: {b: 1, c: 2}}); -> {'a.b': 1, 'a.c': 2}
238
+ * dataDot(new Map([[2, 'c'], [0, 'a']]), 'p.'); -> {'p.2': 'c', 'p.0': 'a'}
239
+ * dataDot(new Map([[2, 'c'], [0, 'a']]), '1'); -> {10: 'a', 12: 'c'} (PHP: [12 => 'c', 10 => 'a'])
240
+ */
241
+ export declare const dataDot: ((data: ReadonlyMap<unknown, unknown>, prepend?: string | undefined, depth?: number | undefined) => Record<string, unknown>) & typeof arrDot & typeof objDot;
242
+ /**
243
+ * Convert dot notation back to nested data.
244
+ *
245
+ * Read in insertion order, a Map's key written last wins; `asArray` skips a dotted key through an earlier scalar.
246
+ *
247
+ * @param data - The dot notation data object to convert
248
+ * @param asArray - Force array-shaped rebuilding (`Arr.undot`) instead of the
249
+ * object-shaped one. JS-only ergonomics with no PHP counterpart; throws if any
250
+ * key's dot segments aren't all non-negative integers.
251
+ * @returns Nested data structure, matching the delegate the chosen branch calls
252
+ * @throws TypeError via `Arr.undot` when `asArray` is set and a key is not an index path.
253
+ *
254
+ * @example
255
+ *
256
+ * dataUndot({'a.b': 1, 'a.c': 2}); -> {a: {b: 1, c: 2}}
257
+ * dataUndot(new Map<string | number, string>([['0.a', 'y'], [0, 'x']])); -> {0: 'x'}
258
+ * dataUndot(new Map([[1, 'p'], ['1.0', 'y']]), true); -> [, 'p'] (PHP: [1 => ['y']])
259
+ */
260
+ export declare function dataUndot(data: ReadonlyMap<unknown, unknown>, asArray?: false | undefined): ReturnType<typeof objUndot>;
261
+ export declare function dataUndot<TValue>(data: ReadonlyMap<number, TValue>, asArray: true): TValue[];
262
+ export declare function dataUndot<TMap>(data: MapData<TMap>, asArray: true): UndotValue<MapEntryValue<TMap>>[];
263
+ export declare function dataUndot<TMap>(data: MapData<TMap>, asArray: boolean): ReturnType<typeof objUndot> | UndotValue<MapEntryValue<TMap>>[];
264
+ export declare function dataUndot<TValue>(data: readonly TValue[] | Iterable<TValue> | UndotPositionalBacking, asArray?: boolean): ReturnType<typeof arrUndot<TValue, number>>;
265
+ export declare function dataUndot<TData extends object>(data: TData, asArray?: false | undefined): ReturnType<typeof objUndot<TData>>;
266
+ export declare function dataUndot<TValue, TKey extends UndotArrayKey>(data: Record<TKey, TValue>, asArray: true | undefined): ReturnType<typeof arrUndot<TValue, TKey>>;
267
+ export declare function dataUndot(data: unknown, asArray?: boolean): ReturnType<typeof objUndot>;
268
+ /**
269
+ * Union multiple objects or arrays items into one, the way PHP's `+` does.
270
+ *
271
+ * The first item that isn't nullish is the backing, and each other item may be a list or an object. A list backing
272
+ * stays a list while every item extends its keys as `0..n-1` in order, and otherwise becomes an object, as PHP's is.
273
+ * Not a `dispatch` pair: `arr.union` drops a non-integer-like key and fills a gap with `undefined`, which `+` does not.
274
+ *
275
+ * @param items - the data items to union
276
+ * @return A new object or array containing all values
277
+ *
278
+ * @example
279
+ *
280
+ * dataUnion(['a'], new Map([[1, 'b'], [2, 'c']])); -> ['a', 'b', 'c']
281
+ * dataUnion(['a'], new Map([[2, 'c'], [1, 'b']])); -> {0: 'a', 1: 'b', 2: 'c'}
282
+ */
283
+ export declare function dataUnion<TValue>(...items: (TValue[] | Record<PropertyKey, TValue> | ReadonlyMap<PropertyKey, unknown> | Iterable<unknown> | NonObjectBacking)[]): TValue[] | {
284
+ [x: string]: TValue | undefined;
285
+ [x: number]: TValue | undefined;
286
+ [x: symbol]: TValue | undefined;
287
+ };
288
+ /**
289
+ * Get all data except specified keys.
290
+ *
291
+ * @param data - The source data
292
+ * @param keys - Keys to exclude
293
+ * @returns Data without specified keys, matching the delegate's own result
294
+ *
295
+ * @remarks JS-only: a list backing RENUMBERS, because a JS array cannot hold a sparse integer
296
+ * key; the keys PHP preserves are observable on the object backing.
297
+ *
298
+ * @example
299
+ *
300
+ * dataExcept([1, 2, 3, 4], [1, 3]); -> [1, 3] (indices 0 and 2)
301
+ * dataExcept({a: 1, b: 2, c: 3}, ['b']); -> {a: 1, c: 3}
302
+ */
303
+ export declare const dataExcept: ((data: ReadonlyMap<unknown, unknown>, keys: PathKeys) => Record<string, unknown>) & typeof arrExcept & typeof objExcept;
304
+ /**
305
+ * Get all data except for specified values.
306
+ *
307
+ * @param data - The data to filter
308
+ * @param values - The values to exclude
309
+ * @param strict - Whether to use strict comparison
310
+ * @returns Data without specified values, matching the delegate's own result
311
+ *
312
+ * @remarks JS-only: a list backing RENUMBERS, because a JS array cannot hold a sparse integer
313
+ * key; the keys PHP preserves are observable on the object backing.
314
+ *
315
+ * @example
316
+ *
317
+ * dataExceptValues(['foo', 'bar', 'baz'], ['foo', 'baz']); -> ['bar']
318
+ * dataExceptValues({name: 'taylor', age: 26}, [26]); -> {name: 'taylor'}
319
+ */
320
+ export declare const dataExceptValues: ((data: ReadonlyMap<unknown, unknown>, values: unknown, strict?: boolean | undefined) => Record<string, unknown>) & typeof arrExceptValues & typeof objExceptValues;
321
+ /**
322
+ * Check if a key exists in data.
323
+ *
324
+ * @param data - The data to check
325
+ * @param key - The key to check for
326
+ * @returns True if key exists, matching the delegate's own result
327
+ *
328
+ * @example
329
+ *
330
+ * dataExists([1, 2, 3], 1); -> true
331
+ * dataExists({a: 1, b: 2}, 'c'); -> false
332
+ */
333
+ export declare const dataExists: ((data: ReadonlyMap<unknown, unknown>, key: PathKey) => boolean) & typeof arrExists & typeof objExists;
334
+ /**
335
+ * Take a limited number of items from data.
336
+ *
337
+ * A Map is counted in its insertion order, so the items taken are the ones PHP's array takes.
338
+ *
339
+ * @param data - The data to take from
340
+ * @param limit - Number of items to take
341
+ * @returns Limited data
342
+ *
343
+ * @remarks JS-only: a list backing RENUMBERS, because a JS array cannot hold a sparse integer
344
+ * key; the keys PHP preserves are observable on the object backing.
345
+ *
346
+ * @example
347
+ *
348
+ * dataTake([1, 2, 3, 4, 5], 3); -> [1, 2, 3]
349
+ * dataTake({a: 1, b: 2, c: 3, d: 4}, 2); -> {a: 1, b: 2}
350
+ * dataTake(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 2); -> {2: 'c', 0: 'a'}
351
+ */
352
+ export declare const dataTake: ((data: ReadonlyMap<unknown, unknown>, limit: number) => Record<string, unknown>) & typeof arrTake & typeof objTake;
353
+ /**
354
+ * Flatten nested data to a specified depth.
355
+ *
356
+ * A Map's values are read in its insertion order; a Map nested inside is kept as a value.
357
+ *
358
+ * @param data - The data to flatten
359
+ * @param depth - The depth to flatten to
360
+ * @returns Flattened data
361
+ *
362
+ * @example
363
+ *
364
+ * dataFlatten([[1, 2], [3, [4, 5]]], 1); -> [1, 2, 3, [4, 5]]
365
+ * dataFlatten({a: {b: {c: 1}}}, 1); -> [{c: 1}]
366
+ * dataFlatten(new Map([[2, ['c']], [0, 'a']])); -> ['c', 'a']
367
+ */
368
+ export declare const dataFlatten: ((data: ReadonlyMap<unknown, unknown>, depth?: number | undefined) => unknown[]) & typeof arrFlatten & typeof objFlatten;
369
+ /**
370
+ * Flip the keys and values of an object or array.
371
+ *
372
+ * A Map is flipped in its insertion order, so when two keys hold the same value, the key
373
+ * PHP reaches last is the one kept.
374
+ *
375
+ * @param data - The data of items to flip
376
+ * @return - the data items flipped, matching the delegate's own result
377
+ *
378
+ * @example
379
+ *
380
+ * dataFlip(['a', 'b']); -> {a: 0, b: 1}
381
+ * dataFlip(new Map([[2, 'v'], [0, 'v']])); -> {v: 0}
382
+ */
383
+ export declare const dataFlip: ((data: ReadonlyMap<unknown, unknown>) => Record<string, string | number>) & typeof arrFlip & typeof objFlip;
384
+ /**
385
+ * Get a float value from data.
386
+ *
387
+ * @param data - The data to get from
388
+ * @param key - The key to get
389
+ * @param defaultValue - Default float value, `null` when omitted, as in PHP
390
+ * @returns Float value or default
391
+ *
392
+ * @example
393
+ *
394
+ * dataFloat([1.5, 2.7], 0, 0.0); -> 1.5
395
+ * dataFloat({price: 9.99}, 'price', 0.0); -> 9.99
396
+ */
397
+ export declare const dataFloat: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, defaultValue?: (number | (() => number)) | null | undefined) => number) & typeof arrFloat & typeof objFloat;
398
+ /**
399
+ * Remove keys from data.
400
+ *
401
+ * @param data - The data to remove from
402
+ * @param keys - Keys to remove
403
+ * @returns Data with keys removed, matching the delegate's own result
404
+ *
405
+ * @example
406
+ *
407
+ * dataForget([1, 2, 3, 4], [1, 3]); -> [1, 3] (removes indices 1 and 3)
408
+ * dataForget({a: 1, b: 2, c: 3}, ['b']); -> {a: 1, c: 3}
409
+ */
410
+ export declare const dataForget: ((data: ReadonlyMap<unknown, unknown>, keys: PathKeys) => Record<string, unknown>) & typeof arrForget & typeof objForget;
411
+ /**
412
+ * Create data from various item types.
413
+ *
414
+ * @param items - The items to create data from
415
+ * @returns Data created from items, matching the delegate's own result
416
+ *
417
+ * @example
418
+ *
419
+ * dataFrom([1, 2, 3]); -> [1, 2, 3]
420
+ * dataFrom({a: 1, b: 2}); -> {a: 1, b: 2}
421
+ * dataFrom(new Map([['a', 1]])); -> {a: 1}
422
+ * dataFrom(new Set([1, 2])); -> [1, 2]
423
+ */
424
+ export declare const dataFrom: ((data: ReadonlyMap<unknown, unknown>) => Record<string, unknown>) & typeof arrFrom & typeof objFrom;
425
+ /**
426
+ * Get a value from data by key.
427
+ *
428
+ * @param data - The data to get from
429
+ * @param key - The key to get
430
+ * @param defaultValue - Default value if key doesn't exist
431
+ * @returns The value or default, matching the delegate's own result
432
+ *
433
+ * @example
434
+ *
435
+ * dataGet([1, 2, 3], 1, 'default'); -> 2
436
+ * dataGet({a: 1, b: 2}, 'c', 'default'); -> 'default'
437
+ */
438
+ export declare const dataGet: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, defaultValue?: unknown) => unknown) & typeof arrGet & typeof objGet;
439
+ /**
440
+ * Check if data has specified keys.
441
+ *
442
+ * @param data - The data to check
443
+ * @param keys - Keys to check for
444
+ * @returns True if has keys
445
+ *
446
+ * @example
447
+ *
448
+ * dataHas([1, 2, 3], [0, 1]); -> true
449
+ * dataHas({a: 1, b: 2}, ['a', 'c']); -> false
450
+ */
451
+ export declare const dataHas: ((data: ReadonlyMap<unknown, unknown>, keys: PathKeys) => boolean) & typeof arrHas & typeof objHas;
452
+ /**
453
+ * Check if data has all specified keys.
454
+ *
455
+ * @param data - The data to check
456
+ * @param keys - Keys to check for
457
+ * @returns True if has all keys
458
+ *
459
+ * @example
460
+ *
461
+ * dataHasAll([1, 2, 3], [0, 1]); -> true
462
+ * dataHasAll({a: 1, b: 2}, ['a', 'c']); -> false
463
+ */
464
+ export declare const dataHasAll: ((data: ReadonlyMap<unknown, unknown>, keys: PathKeys) => boolean) & typeof arrHasAll & typeof objHasAll;
465
+ /**
466
+ * Check if data has any of the specified keys.
467
+ *
468
+ * @param data - The data to check
469
+ * @param keys - Keys to check for
470
+ * @returns True if has any keys
471
+ *
472
+ * @example
473
+ *
474
+ * dataHasAny([1, 2, 3], [0, 5]); -> true
475
+ * dataHasAny({a: 1, b: 2}, ['c', 'd']); -> false
476
+ */
477
+ export declare const dataHasAny: ((data: ReadonlyMap<unknown, unknown>, keys: PathKeys) => boolean) & typeof arrHasAny & typeof objHasAny;
478
+ /**
479
+ * Test if every item in data passes a test.
480
+ *
481
+ * A Map's keys are cast as PHP casts an array key, so the keys PHP stores as one (`1` and `"1"`) are visited once.
482
+ *
483
+ * @param data - The data to test
484
+ * @param callback - The test function
485
+ * @returns True if every item passes
486
+ *
487
+ * @remarks A Map backing widens the callback's value parameter to `unknown`.
488
+ *
489
+ * @example
490
+ *
491
+ * dataEvery([2, 4, 6], (value) => value % 2 === 0); -> true
492
+ * dataEvery({a: 2, b: 4}, (value) => value % 2 === 0); -> true
493
+ * dataEvery(new Map([['a', 2]]), (value) => value % 2 === 0); -> true
494
+ * dataEvery(new Map([['2', 'c'], ['0', 'a']]), (value, key) => typeof key === 'number'); -> true
495
+ * dataEvery(new Set([2, 4]), (value) => value % 2 === 0); -> true
496
+ */
497
+ export declare const dataEvery: ((data: ReadonlyMap<unknown, unknown>, callback: (value: unknown, key: string | number) => unknown) => boolean) & typeof arrEvery & typeof objEvery;
498
+ /**
499
+ * Test if some items in data pass a test.
500
+ *
501
+ * A Map's keys are cast as PHP casts them, so the keys PHP stores as one (`1` and `"1"`) are one item, the last value.
502
+ *
503
+ * @param data - The data to test
504
+ * @param callback - The test function
505
+ * @returns True if some items pass
506
+ *
507
+ * @remarks A Map backing widens the callback's value parameter to `unknown`.
508
+ *
509
+ * @example
510
+ *
511
+ * dataSome([1, 2, 3], (value) => value > 2); -> true
512
+ * dataSome({a: 1, b: 2}, (value) => value > 2); -> false
513
+ * dataSome(new Map([['a', 1], ['b', 3]]), (value) => value > 2); -> true
514
+ * dataSome(new Map([[1, 'a'], ['1', 'b']]), (value) => value === 'a'); -> false
515
+ * dataSome(new Set([1, 3]), (value) => value > 2); -> true
516
+ */
517
+ export declare const dataSome: ((data: ReadonlyMap<unknown, unknown>, callback: (value: unknown, key: string | number) => unknown) => boolean) & typeof arrSome & typeof objSome;
518
+ /**
519
+ * Get an integer value from data.
520
+ *
521
+ * @param data - The data to get from
522
+ * @param key - The key to get
523
+ * @param defaultValue - Default integer value, `null` when omitted, as in PHP
524
+ * @returns Integer value or default
525
+ *
526
+ * @example
527
+ *
528
+ * dataInteger([1, 2, 3], 0, 0); -> 1
529
+ * dataInteger({count: 42}, 'count', 0); -> 42
530
+ */
531
+ export declare const dataInteger: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, defaultValue?: (number | (() => number)) | null | undefined) => number) & typeof arrInteger & typeof objInteger;
532
+ /**
533
+ * Join data elements with a glue string.
534
+ *
535
+ * A Map is joined in its insertion order, the order PHP's array was written in, which a record
536
+ * loses once its integer keys are out of sequence.
537
+ *
538
+ * @param data - The data to join
539
+ * @param glue - The glue string
540
+ * @param finalGlue - The final glue string for the last item
541
+ * @returns Joined string
542
+ *
543
+ * @example
544
+ *
545
+ * dataJoin([1, 2, 3], ', '); -> '1, 2, 3'
546
+ * dataJoin(['a', 'b', 'c'], ', ', ' and '); -> 'a, b and c'
547
+ * dataJoin(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), ', ', ' and '); -> 'c, a and b'
548
+ */
549
+ export declare const dataJoin: ((data: ReadonlyMap<unknown, unknown>, glue: string, finalGlue?: string | undefined) => string) & typeof arrJoin & typeof objJoin;
550
+ /**
551
+ * Key data by a given key or callback.
552
+ *
553
+ * A Map is walked in its insertion order, so the callback sees its items in PHP's order, and
554
+ * when two items resolve to the same key, the one PHP reaches last is the one kept.
555
+ *
556
+ * @param data - The data to key
557
+ * @param keyBy - Key or callback to key by; the callback receives each item and its key (a list's index)
558
+ * @returns Keyed data, matching the delegate's own result
559
+ *
560
+ * @example
561
+ *
562
+ * dataKeyBy([{id: 1, name: 'John'}, {id: 2, name: 'Jane'}], 'id');
563
+ * -> {1: {id: 1, name: 'John'}, 2: {id: 2, name: 'Jane'}}
564
+ * dataKeyBy(new Map([[2, {id: 'r'}], [0, {id: 'p'}]]), 'id'); -> {r: {id: 'r'}, p: {id: 'p'}}
565
+ */
566
+ export declare const dataKeyBy: ((data: ReadonlyMap<unknown, unknown>, keyBy: PathKey | ((item: unknown, key: string | number) => PropertyKey | boolean | null | undefined)) => Record<string, unknown>) & typeof arrKeyBy & typeof objKeyBy;
567
+ /**
568
+ * Prepend keys with a given prefix.
569
+ *
570
+ * A Map is walked in its insertion order. The result is a plain object, so the integer-like keys an empty prefix or
571
+ * one starting with a digit from 1 to 9 can leave are listed first, ascending, not in PHP's order.
572
+ *
573
+ * @param data - The data to prepend keys to
574
+ * @param prependWith - The prefix to prepend
575
+ * @returns Data with prepended keys, matching the delegate's own result
576
+ *
577
+ * @example
578
+ *
579
+ * dataPrependKeysWith({name: 'John', age: 30}, 'user_');
580
+ * -> {user_name: 'John', user_age: 30}
581
+ * dataPrependKeysWith(new Map([[2, 'c'], [0, 'a']]), 'k'); -> {k2: 'c', k0: 'a'}
582
+ * dataPrependKeysWith(new Map([['x', 1], [2, 'c'], [0, 'a']]), '1'); -> {10: 'a', 12: 'c', '1x': 1}
583
+ */
584
+ export declare const dataPrependKeysWith: ((data: ReadonlyMap<unknown, unknown>, prependWith: string) => Record<string, unknown>) & typeof arrPrependKeysWith & typeof objPrependKeysWith;
585
+ /**
586
+ * Get only specified keys from data.
587
+ *
588
+ * A keyed backing's items come back in its own order (a Map's insertion order), not in the order of `keys`.
589
+ *
590
+ * @param data - The data to get from
591
+ * @param keys - Keys to include
592
+ * @returns Data with only specified keys, matching the delegate's own result
593
+ *
594
+ * @remarks JS-only: a list backing RENUMBERS, because a JS array cannot hold a sparse integer
595
+ * key; the keys PHP preserves are observable on the object backing.
596
+ *
597
+ * @example
598
+ *
599
+ * dataOnly([1, 2, 3, 4], [0, 2]); -> [1, 3]
600
+ * dataOnly({a: 1, b: 2, c: 3}, ['a', 'c']); -> {a: 1, c: 3}
601
+ * dataOnly(new Map([['b', 1], [0, 2], ['a', 3]]), ['a', 'b']); -> {b: 1, a: 3}
602
+ */
603
+ export declare const dataOnly: ((data: ReadonlyMap<unknown, unknown>, keys: PathKeys) => Record<string, unknown>) & typeof arrOnly & typeof objOnly;
604
+ /**
605
+ * Get only items with specified values from data.
606
+ *
607
+ * @param data - The data to filter
608
+ * @param values - The values to include
609
+ * @param strict - Whether to use strict comparison
610
+ * @returns Data with only specified values, matching the delegate's own result
611
+ *
612
+ * @remarks JS-only: a list backing RENUMBERS, because a JS array cannot hold a sparse integer
613
+ * key; the keys PHP preserves are observable on the object backing.
614
+ *
615
+ * @example
616
+ *
617
+ * dataOnlyValues(['foo', 'bar', 'baz'], ['foo', 'baz']); -> ['foo', 'baz']
618
+ * dataOnlyValues({name: 'taylor', age: 26}, [26]); -> {age: 26}
619
+ */
620
+ export declare const dataOnlyValues: ((data: ReadonlyMap<unknown, unknown>, values: unknown, strict?: boolean | undefined) => Record<string, unknown>) & typeof arrOnlyValues & typeof objOnlyValues;
621
+ /**
622
+ * Select specific keys from data items.
623
+ *
624
+ * @param data - The data to select from
625
+ * @param keys - Keys to select
626
+ * @returns Selected data
627
+ *
628
+ * @example
629
+ *
630
+ * dataSelect([{a: 1, b: 2, c: 3}], ['a', 'c']); -> [{a: 1, c: 3}]
631
+ */
632
+ export declare const dataSelect: ((data: ReadonlyMap<unknown, unknown>, keys: PathKeys) => Record<string, Record<string, unknown>>) & typeof arrSelect & typeof objSelect;
633
+ /**
634
+ * Map data with keys using a callback.
635
+ *
636
+ * Not a `dispatch` pair: the callback's tuple return has to be normalized to a single-pair
637
+ * record before either delegate folds it, and `dispatch` forwards its arguments untouched.
638
+ *
639
+ * A Map is walked in its insertion order, which orders the string keys returned and decides who wins a shared key.
640
+ *
641
+ * @param data - The data to map
642
+ * @param callback - The mapping callback
643
+ * @returns Mapped data with keys
644
+ *
645
+ * @example
646
+ *
647
+ * dataMapWithKeys([1, 2], (value, index) => [`key_${String(index)}`, value * 2]);
648
+ * -> {key_0: 2, key_1: 4}
649
+ * dataMapWithKeys(new Map([[2, 'c'], [0, 'a']]), (value, key) => [`k${key}`, value]); -> {k2: 'c', k0: 'a'}
650
+ */
651
+ export declare function dataMapWithKeys<TMap, TMapWithKeysKey extends PropertyKey, TMapWithKeysValue>(data: MapData<TMap>, callback: (value: MapEntryValue<TMap>, key: MapEntryKey<TMap>) => readonly [TMapWithKeysKey, TMapWithKeysValue]): Record<TMapWithKeysKey, TMapWithKeysValue>;
652
+ export declare function dataMapWithKeys<TMap, TMapWithKeysKey extends PropertyKey, TMapWithKeysValue>(data: MapData<TMap>, callback: (value: MapEntryValue<TMap>, key: MapEntryKey<TMap>) => Record<TMapWithKeysKey, TMapWithKeysValue>): Record<TMapWithKeysKey, TMapWithKeysValue>;
653
+ export declare function dataMapWithKeys<TValue, TMapWithKeysKey extends PropertyKey, TMapWithKeysValue>(data: ArrayItems<TValue>, callback: (value: TValue, index: number) => readonly [TMapWithKeysKey, TMapWithKeysValue]): Record<TMapWithKeysKey, TMapWithKeysValue>;
654
+ export declare function dataMapWithKeys<TValue, TMapWithKeysValue, TMapWithKeysKey extends string = string>(data: ArrayItems<TValue>, callback: (value: TValue, index: number) => Record<TMapWithKeysKey, TMapWithKeysValue>): Record<TMapWithKeysKey, TMapWithKeysValue>;
655
+ export declare function dataMapWithKeys<TValue, TMapWithKeysKey extends PropertyKey, TMapWithKeysValue, TKey extends PropertyKey = PropertyKey>(data: Record<TKey, TValue>, callback: (value: TValue, key: TKey) => readonly [TMapWithKeysKey, TMapWithKeysValue]): Record<TMapWithKeysKey, TMapWithKeysValue>;
656
+ export declare function dataMapWithKeys<TValue, TMapWithKeysValue, TKey extends PropertyKey = PropertyKey, TMapWithKeysKey extends PropertyKey = PropertyKey>(data: Record<TKey, TValue>, callback: (value: TValue, key: TKey) => Record<TMapWithKeysKey, TMapWithKeysValue>): Record<TMapWithKeysKey, TMapWithKeysValue>;
657
+ /**
658
+ * Map data by spreading array items to callback.
659
+ *
660
+ * A Map is walked in its insertion order, so the callback sees its rows in PHP's order.
661
+ *
662
+ * @param data - The data to map
663
+ * @param callback - The mapping callback
664
+ * @returns Mapped data, matching the delegate's own result
665
+ *
666
+ * @example
667
+ *
668
+ * dataMapSpread([[1, 2], [3, 4]], (a, b) => a + b); -> [3, 7]
669
+ * dataMapSpread(new Map([[2, ['c', 1]], [0, ['a', 2]]]), (x) => x + ++calls); -> {2: 'c1', 0: 'a2'}
670
+ */
671
+ export declare const dataMapSpread: ((data: ReadonlyMap<unknown, unknown>, callback: (...args: unknown[]) => unknown) => Record<string, unknown>) & typeof arrMapSpread & typeof objMapSpread;
672
+ /**
673
+ * Prepend a value to data.
674
+ *
675
+ * A Map is read in its insertion order, and without a key its integer keys are renumbered in that order, as
676
+ * `array_unshift` renumbers PHP's.
677
+ *
678
+ * @param data - The data to prepend to
679
+ * @param value - The value to prepend
680
+ * @param key - The key; omit it to unshift under key 0, as `Arr::prepend` does with two arguments.
681
+ * A list given any key but 0 comes back as an object, as PHP's `[$key => $value] + $list` is keyed
682
+ * @returns Data with prepended value, matching the delegate's own result
683
+ *
684
+ * @example
685
+ *
686
+ * dataPrepend([2, 3], 1); -> [1, 2, 3]
687
+ * dataPrepend({b: 2, c: 3}, 1, 'a'); -> {a: 1, b: 2, c: 3}
688
+ * dataPrepend(new Map([[2, 'c'], [0, 'a']]), 'z'); -> {0: 'z', 1: 'c', 2: 'a'}
689
+ */
690
+ export declare const dataPrepend: ((data: ReadonlyMap<unknown, unknown>, value: unknown, key?: PropertyKey | null | undefined) => Record<string | number, unknown>) & typeof arrPrepend & typeof objPrepend;
691
+ /**
692
+ * Pull and remove a value from data.
693
+ *
694
+ * @param data - The data to pull from
695
+ * @param key - The key to pull
696
+ * @param defaultValue - Default value if key doesn't exist
697
+ * @returns Object with the pulled value and modified data, matching the delegate's own result
698
+ *
699
+ * @example
700
+ *
701
+ * dataPull([1, 2, 3], 1, 'default'); -> {value: 2, data: [1, 3]}
702
+ * dataPull({a: 1, b: 2}, 'b', 'default'); -> {value: 2, data: {a: 1}}
703
+ */
704
+ export declare const dataPull: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, defaultValue?: unknown) => {
705
+ value: unknown;
706
+ data: Record<string, unknown>;
707
+ }) & typeof arrPull & typeof objPull;
708
+ /**
709
+ * Convert data to a query string.
710
+ *
711
+ * A Map is read in its insertion order, so its pairs come out in the order PHP's
712
+ * `http_build_query` writes them. A Map nested inside keyed data is read the same way.
713
+ *
714
+ * @param data - The data to convert
715
+ * @returns Query string representation
716
+ *
717
+ * @example
718
+ *
719
+ * dataQuery({name: 'John', age: 30}); -> 'name=John&age=30'
720
+ * dataQuery([1, 2, 3]); -> '0=1&1=2&2=3'
721
+ * dataQuery(new Map([[2, 'c'], [0, 'a'], [1, 'b']])); -> '2=c&0=a&1=b'
722
+ */
723
+ export declare const dataQuery: ((data: ReadonlyMap<unknown, unknown>) => string) & typeof arrQuery & typeof objQuery;
724
+ /**
725
+ * Get random elements from data.
726
+ *
727
+ * Which elements are picked is random, but they come back in the data's own order, as PHP's
728
+ * picks do. A Map's order is its insertion order.
729
+ *
730
+ * @param data - The data to get random elements from
731
+ * @param number - Number of elements to get
732
+ * @param preserveKeys - Whether to preserve keys
733
+ * @returns Random elements
734
+ *
735
+ * @example
736
+ *
737
+ * dataRandom([1, 2, 3, 4], 2); -> [2, 4] (random selection, in the list's order)
738
+ * dataRandom({a: 1, b: 2, c: 3}, 1); -> {0: 2} (random, reindexed)
739
+ * dataRandom({a: 1, b: 2, c: 3}, 1, true); -> {b: 2} (random, keys kept)
740
+ * dataRandom(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 3); -> {0: 'c', 1: 'a', 2: 'b'}
741
+ */
742
+ export declare const dataRandom: ((data: ReadonlyMap<unknown, unknown>, number?: string | number | null | undefined, preserveKeys?: boolean | undefined) => unknown) & typeof arrRandom & typeof objRandom;
743
+ /**
744
+ * Search for a value in data and return its key.
745
+ *
746
+ * No `Arr::` counterpart or delegate pair, so it is written out after `Collection::search`. A Map is searched in its
747
+ * insertion order, so the first match and the keys a callback is handed follow PHP's order.
748
+ *
749
+ * @param items - The data items to search
750
+ * @param value - The value or callback to search for
751
+ * @param strict - Whether to use strict comparison
752
+ * @returns The found item's key, the index for a list or a numeric-string-keyed record, or false
753
+ *
754
+ * @remarks Comparison follows PHP's `===`/`==`, so an array or object needle matches by value.
755
+ *
756
+ * @example
757
+ *
758
+ * dataSearch([1, 2, 3], 2); -> 1
759
+ * dataSearch({a: 1, b: 2}, 2); -> 'b'
760
+ * dataSearch(new Map([[2, 'x'], [0, 'x'], [1, 'y']]), 'x'); -> 2
761
+ * dataSearch(new Map<string | number, number>([['x', 1], [0, 2], ['y', 3]]), () => true); -> 'x'
762
+ */
763
+ export declare function dataSearch<TMap>(items: MapData<TMap>, value: MapEntryValue<TMap> | string | number | ((item: MapEntryValue<TMap>, key: MapEntryKey<TMap>) => unknown), strict?: boolean): MapEntryKey<TMap> | false;
764
+ export declare function dataSearch<TValue>(items: readonly TValue[], value: TValue | string | number | ((item: TValue, key: number) => unknown), strict?: boolean): number | false;
765
+ export declare function dataSearch<TValue, TKey extends PropertyKey>(items: Record<TKey, TValue>, value: TValue | string | number | ((item: TValue, key: TKey) => unknown), strict?: boolean): TKey | number | false;
766
+ export declare function dataSearch<TValue, TKey extends PropertyKey>(items: DataItems<TValue, TKey>, value: TValue | string | number | ((item: TValue, key: TKey) => unknown), strict?: boolean): TKey | number | false;
767
+ /**
768
+ * Get the item before a specified value in data.
769
+ *
770
+ * No `Arr::` counterpart or delegate pair, so it is written out after `Collection::before`. A Map is read in its
771
+ * insertion order, and the match's key is found with PHP's LOOSE `$keys->search($key)` whatever `strict` says, so
772
+ * an earlier key loosely equal to it (`'01'` and `1`) is the one whose neighbour is returned.
773
+ *
774
+ * @param items - The data items to search
775
+ * @param value - The value or callback to search for
776
+ * @param strict - Whether to use strict comparison
777
+ * @returns The item before the first key loosely equal to the found item's key, or null
778
+ *
779
+ * @example
780
+ *
781
+ * dataBefore([1, 2, 3], 2); -> 1
782
+ * dataBefore(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'a'); -> 'c'
783
+ * dataBefore(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'c'); -> null
784
+ * dataBefore(new Map([['01', 'a'], [1, 'b']]), 'b'); -> null
785
+ */
786
+ export declare function dataBefore<TMap>(items: MapData<TMap>, value: MapEntryValue<TMap> | string | number | ((item: MapEntryValue<TMap>, key: MapEntryKey<TMap>) => unknown), strict?: boolean): MapEntryValue<TMap> | null;
787
+ export declare function dataBefore<TValue>(items: readonly TValue[], value: TValue | string | number | ((item: TValue, key: number) => unknown), strict?: boolean): TValue | null;
788
+ export declare function dataBefore<TValue, TKey extends PropertyKey>(items: Record<TKey, TValue>, value: TValue | string | number | ((item: TValue, key: TKey) => unknown), strict?: boolean): TValue | null;
789
+ export declare function dataBefore<TValue, TKey extends PropertyKey>(items: DataItems<TValue, TKey>, value: TValue | string | number | ((item: TValue, key: TKey) => unknown), strict?: boolean): TValue | null;
790
+ /**
791
+ * Get the item after a specified value in data.
792
+ *
793
+ * No `Arr::` counterpart or delegate pair, so it is written out after `Collection::after`. A Map is read in its
794
+ * insertion order, and the match's key is found with PHP's LOOSE `$keys->search($key)` whatever `strict` says, so
795
+ * an earlier key loosely equal to it (`'01'` and `1`) is the one whose neighbour is returned.
796
+ *
797
+ * @param items - The data items to search
798
+ * @param value - The value or callback to search for
799
+ * @param strict - Whether to use strict comparison
800
+ * @returns The item after the first key loosely equal to the found item's key, or null
801
+ *
802
+ * @example
803
+ *
804
+ * dataAfter([1, 2, 3], 2); -> 3
805
+ * dataAfter(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'c'); -> 'a'
806
+ * dataAfter(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'b'); -> null
807
+ * dataAfter(new Map([['01', 'a'], [1, 'b']]), 'b'); -> 'b'
808
+ */
809
+ export declare function dataAfter<TMap>(items: MapData<TMap>, value: MapEntryValue<TMap> | string | number | ((item: MapEntryValue<TMap>, key: MapEntryKey<TMap>) => unknown), strict?: boolean): MapEntryValue<TMap> | null;
810
+ export declare function dataAfter<TValue>(items: readonly TValue[], value: TValue | string | number | ((item: TValue, key: number) => unknown), strict?: boolean): TValue | null;
811
+ export declare function dataAfter<TValue, TKey extends PropertyKey>(items: Record<TKey, TValue>, value: TValue | string | number | ((item: TValue, key: TKey) => unknown), strict?: boolean): TValue | null;
812
+ export declare function dataAfter<TValue, TKey extends PropertyKey>(items: DataItems<TValue, TKey>, value: TValue | string | number | ((item: TValue, key: TKey) => unknown), strict?: boolean): TValue | null;
813
+ /**
814
+ * Get and remove the first N items from the data, mutating it in place.
815
+ *
816
+ * A count of zero returns an empty array. An empty source returns null for a count of 1 and an empty array for any
817
+ * other. A Map is shifted from the start of its insertion order.
818
+ *
819
+ * @param items - The data to shift from. Mutated in place for an array or record backing; a Map,
820
+ * Set or generator backing is copied first, so the write lands on the copy and is discarded.
821
+ * @param count - Number of items to shift; a fraction is dropped, and NAN shifts every item
822
+ * @returns The shifted item when count is 1, or null if there was none; an array of the shifted items otherwise.
823
+ * @throws InvalidArgumentException if count is negative.
824
+ * @throws Error for a fraction below 2 that the items do not cap, as PHP's range() throws its ValueError.
825
+ *
826
+ * @example
827
+ *
828
+ * dataShift([1, 2, 3]); -> 1
829
+ * dataShift(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 2); -> ['c', 'a'], the Map left as it was
830
+ */
831
+ export declare const dataShift: ((data: ReadonlyMap<unknown, unknown>, count?: number | undefined) => unknown) & typeof arrShift & typeof objShift;
832
+ /**
833
+ * Set a value in data by key.
834
+ *
835
+ * @param data - The data to set value in
836
+ * @param key - The key to set
837
+ * @param value - The value to set
838
+ * @returns Data with the value set, matching the delegate's own result
839
+ *
840
+ * @example
841
+ *
842
+ * dataSet([1, 2, 3], 1, 'new'); -> [1, 'new', 3]
843
+ * dataSet({a: 1, b: 2}, 'c', 3); -> {a: 1, b: 2, c: 3}
844
+ */
845
+ export declare const dataSet: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, value: unknown) => unknown) & typeof arrSet & typeof objSet;
846
+ /**
847
+ * Push values to data.
848
+ *
849
+ * @param data - The data to push to
850
+ * @param key - The key to push to (for objects)
851
+ * @param values - The values to push
852
+ * @returns Data with pushed values, matching the delegate's own result
853
+ *
854
+ * @example
855
+ *
856
+ * dataPush([1, 2], null, 3, 4); -> [1, 2, 3, 4]
857
+ * dataPush({a: [1, 2]}, 'a', 3, 4); -> {a: [1, 2, 3, 4]}
858
+ */
859
+ export declare const dataPush: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, ...values: unknown[]) => Record<string, unknown>) & typeof arrPush & typeof objPush;
860
+ declare const unshiftBacking: ((data: ReadonlyMap<unknown, unknown>, ...rest: unknown[]) => Record<string | number, unknown>) & typeof arrUnshift & typeof objUnshift;
861
+ /**
862
+ * Prepend one or more items to the beginning of the data items, mutating it in place.
863
+ *
864
+ * A Map's integer keys are renumbered in its insertion order, so each value lands on the key PHP's unshift gives it.
865
+ *
866
+ * @param data - The data to unshift to. Mutated in place for an array or record backing; a Map,
867
+ * Set or generator backing is copied first, so the write lands on the copy and is discarded.
868
+ * @param items - The items to prepend
869
+ * @returns The same data reference, mutated; for a Set or generator the copy, and for a Map a record built from it.
870
+ *
871
+ * @example
872
+ *
873
+ * dataUnshift([2, 3], 1); -> [1, 2, 3]
874
+ * dataUnshift(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'U'); -> {0: 'U', 1: 'c', 2: 'a', 3: 'b'}
875
+ */
876
+ export declare const dataUnshift: typeof unshiftBacking;
877
+ /**
878
+ * Shuffle data randomly.
879
+ *
880
+ * @param data - The data to shuffle
881
+ * @returns Shuffled data
882
+ *
883
+ * @example
884
+ *
885
+ * dataShuffle([1, 2, 3, 4]); -> [3, 1, 4, 2] (random order)
886
+ * dataShuffle({a: 1, b: 2, c: 3}); -> {0: 3, 1: 1, 2: 2} (random order, reindexed 0..n-1)
887
+ */
888
+ export declare const dataShuffle: ((data: ReadonlyMap<unknown, unknown>) => Record<number, unknown>) & typeof arrShuffle & typeof objShuffle;
889
+ /**
890
+ * Skip items in the data until the given condition is met.
891
+ *
892
+ * A value is compared with PHP's `===`; a callback is handed each value and key, and PHP truthiness judges its answer.
893
+ * A Map is walked in its insertion order.
894
+ *
895
+ * @param data - The data to skip items of
896
+ * @param value - The value to skip until, or a callback answering whether an item meets the condition
897
+ * @returns The items from the first that meets the condition on, matching the delegate's own result
898
+ *
899
+ * @example
900
+ *
901
+ * dataSkipUntil([1, 2, 3, 4], 3); -> [3, 4]
902
+ * dataSkipUntil({a: 1, b: 2, c: 3}, (value, key) => key === 'b'); -> {b: 2, c: 3}
903
+ * dataSkipUntil(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'a'); -> {0: 'a', 1: 'b'}
904
+ */
905
+ export declare const dataSkipUntil: ((data: ReadonlyMap<unknown, unknown>, value: {} | ((value: unknown, key: string | number) => unknown) | null | undefined) => Record<string, unknown>) & typeof arrSkipUntil & typeof objSkipUntil;
906
+ /**
907
+ * Skip items in the data while the given condition is met.
908
+ *
909
+ * A value is compared with PHP's `===`; a callback is handed each value and key, and PHP truthiness judges its answer.
910
+ * A Map is walked in its insertion order.
911
+ *
912
+ * @param data - The data to skip items of
913
+ * @param value - The value to skip while items equal it, or a callback answering whether an item meets the condition
914
+ * @returns The items from the first that fails the condition on, matching the delegate's own result
915
+ *
916
+ * @example
917
+ *
918
+ * dataSkipWhile([1, 1, 2, 1], 1); -> [2, 1]
919
+ * dataSkipWhile({a: 1, b: 2, c: 1}, 1); -> {b: 2, c: 1}
920
+ * dataSkipWhile(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'c'); -> {0: 'a', 1: 'b'}
921
+ */
922
+ export declare const dataSkipWhile: ((data: ReadonlyMap<unknown, unknown>, value: {} | ((value: unknown, key: string | number) => unknown) | null | undefined) => Record<string, unknown>) & typeof arrSkipWhile & typeof objSkipWhile;
923
+ /**
924
+ * Slice the underlying data items
925
+ *
926
+ * A Map is sliced by its insertion order, so the offset and length count the items PHP's
927
+ * array holds in that order.
928
+ *
929
+ * @param data - The data to slice
930
+ * @param offset - The starting index
931
+ * @param length - The number of items to include
932
+ * @returns Sliced data
933
+ *
934
+ * @example
935
+ *
936
+ * dataSlice([1, 2, 3, 4], 1, 2); -> [2, 3]
937
+ * dataSlice(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 1); -> {0: 'a', 1: 'b'}
938
+ */
939
+ export declare const dataSlice: ((data: ReadonlyMap<unknown, unknown>, offset: number, length?: number | null | undefined) => Record<string, unknown>) & typeof arrSlice & typeof objSlice;
940
+ /**
941
+ * Get the sole item that passes a test.
942
+ *
943
+ * A Map is read in its insertion order, and the keys PHP stores as one (`1` and `"1"`) count as one item.
944
+ *
945
+ * @param data - The data to search
946
+ * @param callback - The test function
947
+ * @returns The sole matching item
948
+ * @throws Error if more than one or no items match
949
+ *
950
+ * @remarks JS-only: PHP's `ItemNotFoundException`/`MultipleItemsFoundException` have no JS
951
+ * analogue, so `@tolki/utils` ships same-named `Error` subclasses in their place.
952
+ *
953
+ * @example
954
+ *
955
+ * dataSole([1, 2, 3], (value) => value > 2); -> 3
956
+ * dataSole({a: 1, b: 2, c: 3}, (value) => value === 2); -> 2
957
+ * dataSole(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), (value) => value === 'c'); -> 'c' (keys seen: 2, 0, 1)
958
+ * dataSole(new Map([[1, 'a'], ['1', 'b']])); -> 'b'
959
+ */
960
+ export declare const dataSole: ((data: ReadonlyMap<unknown, unknown>, callback?: ((value: unknown, key: string | number) => unknown) | undefined) => unknown) & typeof arrSole & typeof objSole;
961
+ /**
962
+ * Sort data using a callback.
963
+ *
964
+ * A Map is read in its insertion order, so ties and the callback's keys follow PHP's order; its integer keys are then
965
+ * renumbered over the sorted sequence, as a record's are.
966
+ *
967
+ * @param data - The data to sort
968
+ * @param callback - The value extractor callback or key to sort by
969
+ * @returns Sorted data, matching the delegate's own result
970
+ *
971
+ * @example
972
+ *
973
+ * dataSort([3, 1, 4, 2]); -> [1, 2, 3, 4]
974
+ * dataSort({c: 3, a: 1, b: 2}); -> {a: 1, b: 2, c: 3}
975
+ * dataSort(new Map([[2, {n: 1, id: 'p'}], [0, {n: 1, id: 'q'}], [1, {n: 0, id: 'r'}]]), 'n');
976
+ * -> {0: {n: 0, id: 'r'}, 1: {n: 1, id: 'p'}, 2: {n: 1, id: 'q'}}
977
+ */
978
+ export declare const dataSort: ((data: ReadonlyMap<unknown, unknown>, callback?: string | readonly SortSpec<unknown>[] | ((value: unknown, key: string | number) => unknown) | null | undefined) => Record<string, unknown>) & typeof arrSort & typeof objSort;
979
+ /**
980
+ * Sort data in descending order using a callback.
981
+ *
982
+ * A Map is read in its insertion order, so ties and the callback's keys follow PHP's order; its integer keys are then
983
+ * renumbered over the sorted sequence, as a record's are.
984
+ *
985
+ * @param data - The data to sort
986
+ * @param callback - The comparison callback or key to sort by
987
+ * @returns Sorted data in descending order, matching the delegate's own result
988
+ *
989
+ * @example
990
+ *
991
+ * dataSortDesc([1, 3, 2, 4]); -> [4, 3, 2, 1]
992
+ * dataSortDesc({a: 1, c: 3, b: 2}); -> {c: 3, b: 2, a: 1}
993
+ * dataSortDesc(new Map([[2, {n: 1, id: 'p'}], [0, {n: 1, id: 'q'}], [1, {n: 0, id: 'r'}]]), 'n');
994
+ * -> {0: {n: 1, id: 'p'}, 1: {n: 1, id: 'q'}, 2: {n: 0, id: 'r'}}
995
+ */
996
+ export declare const dataSortDesc: ((data: ReadonlyMap<unknown, unknown>, callback?: string | readonly SortSpec<unknown>[] | ((value: unknown, key: string | number) => unknown) | null | undefined) => Record<string, unknown>) & typeof arrSortDesc & typeof objSortDesc;
997
+ /**
998
+ * Sort data recursively.
999
+ *
1000
+ * A Map backing is read in its insertion order, the order `array_is_list` walks, so a Map keyed
1001
+ * `1, 0` is not a list and is sorted by key, each key keeping its own value. A Map inside the
1002
+ * data is a value like any other object that is not a plain one, and is kept as it is.
1003
+ *
1004
+ * @param data - The data to sort recursively
1005
+ * @param descending - Whether to sort in descending order
1006
+ * @returns Recursively sorted data, matching the delegate's own result
1007
+ *
1008
+ * @example
1009
+ *
1010
+ * dataSortRecursive({b: {y: 2, x: 1}, a: {z: 3, w: 4}}); -> {a: {w: 4, z: 3}, b: {x: 1, y: 2}}
1011
+ * dataSortRecursive(new Map([[1, 'a'], [0, 'b']])); -> {0: 'b', 1: 'a'}
1012
+ */
1013
+ export declare const dataSortRecursive: ((data: ReadonlyMap<unknown, unknown>, descending?: boolean | CaseValue<DefineEnumResult<{
1014
+ readonly Ascending: "Ascending";
1015
+ readonly Descending: "Descending";
1016
+ readonly backed: false;
1017
+ readonly _cases: readonly ["Ascending", "Descending"];
1018
+ }>> | undefined) => Record<string, unknown>) & typeof arrSortRecursive & typeof objSortRecursive;
1019
+ /**
1020
+ * Sort data recursively in descending order.
1021
+ *
1022
+ * A Map backing is read in its insertion order, so one keyed `2, 0, 1` is not a list and is sorted by key.
1023
+ *
1024
+ * @param data - The data to sort recursively
1025
+ * @returns Recursively sorted data in descending order, matching the delegate's own result
1026
+ *
1027
+ * @remarks JS-only: a JS object lists integer-like keys first, ascending, whatever the sort produced, so only the
1028
+ * string keys' relative order, and which value each key holds, match PHP's.
1029
+ *
1030
+ * @example
1031
+ *
1032
+ * dataSortRecursiveDesc({a: {w: 4, z: 3}, b: {x: 1, y: 2}}); -> {b: {y: 2, x: 1}, a: {z: 3, w: 4}}
1033
+ * dataSortRecursiveDesc(new Map([[2, 'c'], [0, 'a'], [1, 'b']])); -> {0: 'a', 1: 'b', 2: 'c'}
1034
+ */
1035
+ export declare const dataSortRecursiveDesc: ((data: ReadonlyMap<unknown, unknown>) => Record<string, unknown>) & typeof arrSortRecursiveDesc & typeof objSortRecursiveDesc;
1036
+ /**
1037
+ * Splice a portion of the data items, mutating it in place, and return only what was removed.
1038
+ *
1039
+ * A Map is spliced in its insertion order. What is removed keeps its string keys and renumbers integer keys from 0.
1040
+ *
1041
+ * @param data - The data to splice. Mutated in place for an array or record backing; a Map, Set
1042
+ * or generator backing is copied first, so the write lands on the copy and is discarded.
1043
+ * @param offset - The starting index; a fraction is dropped
1044
+ * @param length - The number of items to remove, a fraction dropped. Null or none removes everything
1045
+ * from offset to the end, as array_splice()'s ?int length reads null.
1046
+ * @param replacement - The items to insert
1047
+ * @returns The removed items.
1048
+ * @throws TypeError when the offset or the length is NAN, infinite or outside PHP's int range, which array_splice()
1049
+ * refuses.
1050
+ *
1051
+ * @example
1052
+ *
1053
+ * dataSplice([1, 2, 3, 4], 1, 2); -> [2, 3]
1054
+ * dataSplice(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 1); -> {0: 'a', 1: 'b'}
1055
+ */
1056
+ export declare const dataSplice: ((data: ReadonlyMap<unknown, unknown>, offset: number, length?: number | null | undefined, ...replacement: unknown[]) => Record<string, unknown>) & typeof arrSplice & typeof objSplice;
1057
+ /**
1058
+ * Take items in the data until the given condition is met.
1059
+ *
1060
+ * A value is compared with PHP's `===`; a callback is handed each value and key, and PHP truthiness judges its answer.
1061
+ * A Map is walked in its insertion order.
1062
+ *
1063
+ * @param data - The data to take items from
1064
+ * @param value - The value to take until, or a callback answering whether an item meets the condition
1065
+ * @returns The items before the first that meets the condition, matching the delegate's own result
1066
+ *
1067
+ * @example
1068
+ *
1069
+ * dataTakeUntil([1, 2, 3, 4], 3); -> [1, 2]
1070
+ * dataTakeUntil({a: 1, b: 2, c: 3}, (value, key) => key === 'c'); -> {a: 1, b: 2}
1071
+ * dataTakeUntil(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'a'); -> {2: 'c'}
1072
+ */
1073
+ export declare const dataTakeUntil: ((data: ReadonlyMap<unknown, unknown>, value: {} | ((value: unknown, key: string | number) => unknown) | null | undefined) => Record<string, unknown>) & typeof arrTakeUntil & typeof objTakeUntil;
1074
+ /**
1075
+ * Take items in the data while the given condition is met.
1076
+ *
1077
+ * A value is compared with PHP's `===`; a callback is handed each value and key, and PHP truthiness judges its answer.
1078
+ * A Map is walked in its insertion order.
1079
+ *
1080
+ * @param data - The data to take items from
1081
+ * @param value - The value to take while items equal it, or a callback answering whether an item meets the condition
1082
+ * @returns The items before the first that fails the condition, matching the delegate's own result
1083
+ *
1084
+ * @example
1085
+ *
1086
+ * dataTakeWhile([1, 1, 2, 2, 3, 3], 1); -> [1, 1]
1087
+ * dataTakeWhile({a: 1, b: 1, c: 2, d: 1}, 1); -> {a: 1, b: 1}
1088
+ * dataTakeWhile(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 'c'); -> {2: 'c'}
1089
+ */
1090
+ export declare const dataTakeWhile: ((data: ReadonlyMap<unknown, unknown>, value: {} | ((value: unknown, key: string | number) => unknown) | null | undefined) => Record<string, unknown>) & typeof arrTakeWhile & typeof objTakeWhile;
1091
+ /**
1092
+ * Get a string value from data.
1093
+ *
1094
+ * @param data - The data to get from
1095
+ * @param key - The key to get
1096
+ * @param defaultValue - Default string value, `null` when omitted, as in PHP
1097
+ * @returns String value or default
1098
+ *
1099
+ * @example
1100
+ *
1101
+ * dataString(['hello', 'world'], 0, ''); -> 'hello'
1102
+ * dataString({name: 'John'}, 'name', ''); -> 'John'
1103
+ */
1104
+ export declare const dataString: ((data: ReadonlyMap<unknown, unknown>, key: PathKey, defaultValue?: (string | (() => string)) | null | undefined) => string) & typeof arrString & typeof objString;
1105
+ /**
1106
+ * Convert data to CSS classes string.
1107
+ *
1108
+ * A Map is read in its insertion order, so its classes come out in the order PHP's array
1109
+ * lists them, integer keys and string keys interleaved as they were written.
1110
+ *
1111
+ * @param data - The data to convert
1112
+ * @returns CSS classes string
1113
+ *
1114
+ * @example
1115
+ *
1116
+ * dataToCssClasses(['btn', 'btn-primary']); -> 'btn btn-primary'
1117
+ * dataToCssClasses({btn: true, 'btn-primary': true, disabled: false}); -> 'btn btn-primary'
1118
+ * dataToCssClasses(new Map([[2, 'c2'], ['x', true], [0, 'c0']])); -> 'c2 x c0'
1119
+ */
1120
+ export declare const dataToCssClasses: ((data: ReadonlyMap<unknown, unknown>) => string) & typeof arrToCssClasses & typeof objToCssClasses;
1121
+ /**
1122
+ * Convert data to CSS styles string.
1123
+ *
1124
+ * A Map is read in its insertion order, so its styles come out in the order PHP's array
1125
+ * lists them, integer keys and string keys interleaved as they were written.
1126
+ *
1127
+ * @param data - The data to convert
1128
+ * @returns CSS styles string
1129
+ *
1130
+ * @example
1131
+ *
1132
+ * dataToCssStyles(['color:red', 'font-size:14px']); -> 'color:red; font-size:14px;'
1133
+ * dataToCssStyles({'color:red': true, 'display:none': false}); -> 'color:red;'
1134
+ * dataToCssStyles(new Map([['x:1', true], [0, 'z:0'], ['y:1', true]])); -> 'x:1; z:0; y:1;'
1135
+ */
1136
+ export declare const dataToCssStyles: ((data: ReadonlyMap<unknown, unknown>) => string) & typeof arrToCssStyles & typeof objToCssStyles;
1137
+ /**
1138
+ * Filter data where callback returns true.
1139
+ *
1140
+ * A Map is walked in its insertion order, so a callback that counts its calls keeps the items PHP keeps.
1141
+ *
1142
+ * @param data - The data to filter
1143
+ * @param callback - The test function
1144
+ * @returns Filtered data, matching the delegate's own result
1145
+ *
1146
+ * @remarks JS-only: a list backing RENUMBERS, because a JS array cannot hold a sparse integer
1147
+ * key; the keys PHP preserves are observable on the object backing.
1148
+ *
1149
+ * @example
1150
+ *
1151
+ * dataWhere([1, 2, 3, 4], (value) => value > 2); -> [3, 4]
1152
+ * dataWhere({a: 1, b: 2, c: 3}, (value) => value > 1); -> {b: 2, c: 3}
1153
+ * dataWhere(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), () => ++calls <= 2); -> {2: 'c', 0: 'a'}
1154
+ */
1155
+ export declare const dataWhere: ((data: ReadonlyMap<unknown, unknown>, callback: (value: unknown, key: string | number) => unknown) => Record<string, unknown>) & typeof arrWhere & typeof objWhere;
1156
+ /**
1157
+ * Replace the data items with the given items.
1158
+ *
1159
+ * `replacerData` may be a list or an object on either backing. A list backing stays a list while the result's keys run
1160
+ * `0..n-1` in order; a string key, a gap or a Map adding `2` before `1` makes it an object, as PHP's result is keyed.
1161
+ * Not a `dispatch` pair: `arr.replace` returns `TValue[]`, which drops a string key and fills a gap with `undefined`.
1162
+ *
1163
+ * @param data - The original data
1164
+ * @param replacerData - The items to replace with. `null`/`undefined` is a no-op.
1165
+ * @returns The replaced data, matching the delegate's own result
1166
+ *
1167
+ * @example
1168
+ *
1169
+ * dataReplace(['a', 'b'], new Map([[2, 'c'], [3, 'd']])); -> ['a', 'b', 'c', 'd']
1170
+ * dataReplace(['a', 'b'], new Map([[3, 'd'], [2, 'c']])); -> {0: 'a', 1: 'b', 2: 'c', 3: 'd'}
1171
+ */
1172
+ export declare function dataReplace<TValue, TReplacer extends object = object>(data: readonly TValue[], replacerData: TReplacer | null | undefined): ListWhenIndexed<ReturnType<typeof objReplace<Record<string, TValue>, TReplacer>>>;
1173
+ export declare function dataReplace<TReplacer extends object = object>(data: ReadonlyMap<PropertyKey, unknown>, replacerData: TReplacer | null | undefined): ReturnType<typeof objReplace>;
1174
+ export declare function dataReplace<TData extends object, TReplacer extends object = object>(data: TData, replacerData: TReplacer | null | undefined): ReturnType<typeof objReplace<TData, TReplacer>>;
1175
+ export declare function dataReplace(data: unknown, replacerData: unknown): ReturnType<typeof objReplace>;
1176
+ /**
1177
+ * Recursively replace the data items with the given items recursively.
1178
+ *
1179
+ * `replacerData` may take either shape, and a list backing becomes an object for a keyed result, as for `dataReplace`.
1180
+ * Not a `dispatch` pair for the same reason: `arr.replaceRecursive` returns `TValue[]`, which cannot hold PHP's keys.
1181
+ *
1182
+ * @param data - The original data
1183
+ * @param replacerData - The items to replace with. `null`/`undefined` is a no-op.
1184
+ * @returns The replaced data, matching the delegate's own result
1185
+ *
1186
+ * @example
1187
+ *
1188
+ * dataReplaceRecursive(['a'], new Map([[1, 'b'], [2, 'c']])); -> ['a', 'b', 'c']
1189
+ * dataReplaceRecursive(['a'], new Map([[2, 'c'], [1, 'b']])); -> {0: 'a', 1: 'b', 2: 'c'}
1190
+ */
1191
+ export declare function dataReplaceRecursive<TValue, TReplacer extends object = object>(data: readonly TValue[], replacerData: TReplacer | null | undefined): ListWhenIndexed<ReturnType<typeof objReplaceRecursive<Record<string, TValue>, TReplacer>>>;
1192
+ export declare function dataReplaceRecursive<TReplacer extends object = object>(data: ReadonlyMap<PropertyKey, unknown>, replacerData: TReplacer | null | undefined): ReturnType<typeof objReplaceRecursive>;
1193
+ export declare function dataReplaceRecursive<TData extends object, TReplacer extends object = object>(data: TData, replacerData: TReplacer | null | undefined): ReturnType<typeof objReplaceRecursive<TData, TReplacer>>;
1194
+ export declare function dataReplaceRecursive(data: unknown, replacerData: unknown): ReturnType<typeof objReplaceRecursive>;
1195
+ /**
1196
+ * Filter data where callback returns false.
1197
+ *
1198
+ * A Map is walked in its insertion order, so a callback that counts its calls drops the items PHP drops.
1199
+ *
1200
+ * @param data - The data to filter
1201
+ * @param callback - The test function
1202
+ * @returns Filtered data (rejected items), matching the delegate's own result
1203
+ *
1204
+ * @remarks JS-only: the callback is REQUIRED — PHP's no-argument form drops every truthy value,
1205
+ * which no typed row expresses — and a list backing renumbers, since JS has no sparse key.
1206
+ *
1207
+ * @example
1208
+ *
1209
+ * dataReject([1, 2, 3, 4], (value) => value > 2); -> [1, 2]
1210
+ * dataReject({a: 1, b: 2, c: 3}, (value) => value > 1); -> {a: 1}
1211
+ * dataReject(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), () => ++calls <= 1); -> {0: 'a', 1: 'b'}
1212
+ */
1213
+ export declare const dataReject: ((data: ReadonlyMap<unknown, unknown>, callback: (value: unknown, key: string | number) => unknown) => Record<string, unknown>) & typeof arrReject & typeof objReject;
1214
+ /**
1215
+ * Reverse the data items.
1216
+ *
1217
+ * A Map is reversed from its insertion order, so its values come out in the order PHP's reversed array holds them.
1218
+ *
1219
+ * @param data - The data to reverse
1220
+ * @returns Reversed data
1221
+ *
1222
+ * @remarks JS-only: PHP keeps each value on its original integer key; a JS object cannot hold
1223
+ * a descending integer order, so an integer-keyed backing is reversed AND renumbered.
1224
+ *
1225
+ * @example
1226
+ *
1227
+ * dataReverse([1, 2, 3]); -> [3, 2, 1]
1228
+ * dataReverse(new Map([[2, 'c'], [0, 'a'], [1, 'b']])); -> {0: 'b', 1: 'a', 2: 'c'}
1229
+ */
1230
+ export declare const dataReverse: ((data: ReadonlyMap<unknown, unknown>) => Record<string, unknown>) & typeof arrReverse & typeof objReverse;
1231
+ /**
1232
+ * Pad data to the specified length with a value.
1233
+ *
1234
+ * A Map is read in its insertion order, so its integer keys are renumbered in that order and
1235
+ * each value lands on the key PHP's padded array gives it.
1236
+ *
1237
+ * @param data - The data to pad
1238
+ * @param size - The desired size; a fraction is dropped
1239
+ * @param value - The value to pad with
1240
+ * @returns Padded data
1241
+ * @throws TypeError when the size is NAN, infinite or outside PHP's int range, as array_pad() refuses it.
1242
+ * @throws Error when the size is past PHP's maximum array size, as array_pad()'s ValueError.
1243
+ *
1244
+ * @example
1245
+ *
1246
+ * dataPad([1, 2], 4, 0); -> [1, 2, 0, 0]
1247
+ * dataPad(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 4, 'P'); -> {0: 'c', 1: 'a', 2: 'b', 3: 'P'}
1248
+ */
1249
+ export declare const dataPad: ((data: ReadonlyMap<unknown, unknown>, size: number, value: unknown) => Record<string | number, unknown>) & typeof arrPad & typeof objPad;
1250
+ /**
1251
+ * Partition data into two groups based on callback.
1252
+ *
1253
+ * A Map is walked in its insertion order, so a callback that counts its calls puts each item on PHP's side.
1254
+ *
1255
+ * @param data - The data to partition
1256
+ * @param callback - The test function
1257
+ * @returns Array with two groups: [passing, failing], matching the delegate's own result
1258
+ *
1259
+ * @remarks JS-only: a list backing RENUMBERS, because a JS array cannot hold a sparse integer
1260
+ * key; the keys PHP preserves are observable on the object backing.
1261
+ *
1262
+ * @example
1263
+ *
1264
+ * dataPartition([1, 2, 3, 4], (value) => value > 2); -> [[3, 4], [1, 2]]
1265
+ * dataPartition({a: 1, b: 2, c: 3}, (value) => value > 1); -> [{b: 2, c: 3}, {a: 1}]
1266
+ * dataPartition(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), () => ++calls <= 1); -> [{2: 'c'}, {0: 'a', 1: 'b'}]
1267
+ */
1268
+ export declare const dataPartition: ((data: ReadonlyMap<unknown, unknown>, callback: (value: unknown, key: string | number) => unknown) => [Record<string, unknown>, Record<string, unknown>]) & typeof arrPartition & typeof objPartition;
1269
+ /**
1270
+ * Filter out null values from data.
1271
+ *
1272
+ * Of the Map keys PHP stores as one (`1` and `"1"`), only the last value is tested, so a `null` written last drops it.
1273
+ *
1274
+ * @param data - The data to filter
1275
+ * @returns Data with null values removed, matching the delegate's own result
1276
+ *
1277
+ * @remarks JS-only: PHP has one null, so the check matches `null` alone and an `undefined` value
1278
+ * survives; a list backing also renumbers, since a JS array has no sparse integer key.
1279
+ *
1280
+ * @example
1281
+ *
1282
+ * dataWhereNotNull([1, null, 2, null, 3]); -> [1, 2, 3]
1283
+ * dataWhereNotNull({a: 1, b: null, c: 2}); -> {a: 1, c: 2}
1284
+ * dataWhereNotNull(new Map([[1, 'a'], ['x', 'm'], ['1', null]])); -> {x: 'm'}
1285
+ */
1286
+ export declare const dataWhereNotNull: ((data: ReadonlyMap<unknown, unknown>) => Record<string, unknown>) & typeof arrWhereNotNull & typeof objWhereNotNull;
1287
+ /**
1288
+ * Get all values from data (array or object).
1289
+ *
1290
+ * A Map's values come back in its insertion order, the order `array_values` lists them in.
1291
+ *
1292
+ * @param data - The data to get values from
1293
+ * @returns Array of all values, matching the delegate's own result
1294
+ *
1295
+ * @example
1296
+ *
1297
+ * dataValues([1, 2, 3]); -> [1, 2, 3]
1298
+ * dataValues({a: 1, b: 2, c: 3}); -> [1, 2, 3]
1299
+ * dataValues(new Map([[2, 'c'], [0, 'a'], [1, 'b']])); -> ['c', 'a', 'b']
1300
+ */
1301
+ export declare const dataValues: ((data: ReadonlyMap<unknown, unknown>) => unknown[]) & typeof arrValues & typeof objValues;
1302
+ /**
1303
+ * Get all keys from data (array or object).
1304
+ *
1305
+ * A Map's keys come back in its insertion order, each the key PHP stores for it, where a
1306
+ * record would list its integer keys ascending.
1307
+ *
1308
+ * @param data - The data to get keys from
1309
+ * @returns Array of all keys, matching the delegate's own result
1310
+ *
1311
+ * @example
1312
+ *
1313
+ * dataKeys([1, 2, 3]); -> [0, 1, 2]
1314
+ * dataKeys({a: 1, b: 2, c: 3}); -> ['a', 'b', 'c']
1315
+ * dataKeys(new Map([[2, 'c'], [0, 'a'], [1, 'b']])); -> [2, 0, 1]
1316
+ */
1317
+ export declare const dataKeys: ((data: ReadonlyMap<unknown, unknown>) => (string | number)[]) & typeof arrKeys & typeof objKeys;
1318
+ /**
1319
+ * Filter data using a callback function.
1320
+ *
1321
+ * A Map is walked in its insertion order, so a callback that counts its calls keeps the items PHP keeps.
1322
+ *
1323
+ * @param data - The data to filter
1324
+ * @param callback - The callback function to test each value
1325
+ * @returns Filtered data, matching the delegate's own result
1326
+ *
1327
+ * @example
1328
+ *
1329
+ * dataFilter([1, 2, 3, 4], (value) => value > 2); -> [3, 4]
1330
+ * dataFilter({a: 1, b: 2, c: 3, d: 4}, (value) => value > 2); -> {c: 3, d: 4}
1331
+ * dataFilter(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), () => ++calls <= 2); -> {2: 'c', 0: 'a'}
1332
+ */
1333
+ export declare const dataFilter: ((data: ReadonlyMap<unknown, unknown>, callback?: ((value: unknown, key: string | number) => unknown) | null | undefined) => Record<string, unknown>) & typeof arrFilter & typeof objFilter;
1334
+ /**
1335
+ * Transform data using a callback function.
1336
+ *
1337
+ * A Map is walked in its insertion order, so the callback sees its items in PHP's order.
1338
+ *
1339
+ * @param data - The data to map
1340
+ * @param callback - The callback function to transform each value
1341
+ * @returns Transformed data, matching the delegate's own result
1342
+ *
1343
+ * @example
1344
+ *
1345
+ * dataMap([1, 2, 3], (value) => value * 2); -> [2, 4, 6]
1346
+ * dataMap({a: 1, b: 2}, (value) => value * 2); -> {a: 2, b: 4}
1347
+ * dataMap(new Map([[2, 'c'], [0, 'a']]), (value) => value + ++calls); -> {2: 'c1', 0: 'a2'}
1348
+ */
1349
+ export declare const dataMap: ((data: ReadonlyMap<unknown, unknown>, callback: (value: unknown, key: string | number) => unknown) => Record<string, unknown>) & typeof arrMap & typeof objMap;
1350
+ /**
1351
+ * Get the first value from data that passes a test.
1352
+ *
1353
+ * A Map is read in its insertion order, and the keys PHP stores as one (`1` and `"1"`) are one item, the last value.
1354
+ *
1355
+ * @param data - The data to search
1356
+ * @param callback - The callback function to test each value
1357
+ * @param defaultValue - The default value to return if no match found
1358
+ * @returns The first matching value or default value
1359
+ *
1360
+ * @remarks A Map backing widens the callback's value parameter to `unknown`.
1361
+ *
1362
+ * @example
1363
+ *
1364
+ * dataFirst([1, 2, 3, 4], (value) => value > 2); -> 3
1365
+ * dataFirst({a: 1, b: 2, c: 3}, (value) => value > 1); -> 2
1366
+ * dataFirst(new Map([['a', 1], ['b', 2]])); -> 1
1367
+ * dataFirst(new Map([[2, 'c'], [0, 'a'], [1, 'b']])); -> 'c'
1368
+ * dataFirst(new Map([[1, 'a'], ['1', 'b']])); -> 'b'
1369
+ */
1370
+ export declare const dataFirst: ((data: ReadonlyMap<unknown, unknown>, callback?: ((value: unknown, key: string | number) => unknown) | null | undefined, defaultValue?: unknown) => unknown) & typeof arrFirst & typeof objFirst;
1371
+ /**
1372
+ * Get the last value from data that passes a test.
1373
+ *
1374
+ * A Map is read in its insertion order, and a `"1"` after a `1` changes that item's value but not its place.
1375
+ *
1376
+ * @param data - The data to search
1377
+ * @param callback - The callback function to test each value
1378
+ * @param defaultValue - The default value to return if no match found
1379
+ * @returns The last matching value or default value
1380
+ *
1381
+ * @remarks A Map backing widens the callback's value parameter to `unknown`.
1382
+ *
1383
+ * @example
1384
+ *
1385
+ * dataLast([1, 2, 3, 4], (value) => value < 4); -> 3
1386
+ * dataLast({a: 1, b: 2, c: 3}, (value) => value > 1); -> 3
1387
+ * dataLast(new Map([['a', 1], ['b', 2]])); -> 2
1388
+ * dataLast(new Map([[2, 'c'], [0, 'a'], [1, 'b']])); -> 'b'
1389
+ * dataLast(new Map([[1, 'a'], [0, 'z'], ['1', 'b']])); -> 'z'
1390
+ */
1391
+ export declare const dataLast: ((data: ReadonlyMap<unknown, unknown>, callback?: ((value: unknown, key: string | number) => unknown) | null | undefined, defaultValue?: unknown) => unknown) & typeof arrLast & typeof objLast;
1392
+ /**
1393
+ * Determine if data contains a value.
1394
+ *
1395
+ * A Map is read in its insertion order, so a callback is handed its keys in the order PHP
1396
+ * walks the array, and the keys PHP stores as one (`1` and `"1"`) hold only the last value.
1397
+ *
1398
+ * @param data - The data to search
1399
+ * @param value - The value to search for or callback function
1400
+ * @returns True if the value exists, false otherwise
1401
+ *
1402
+ * @example
1403
+ *
1404
+ * dataContains([1, 2, 3], 2); -> true
1405
+ * dataContains({a: 1, b: 2}, (value) => value > 1); -> true
1406
+ * dataContains(new Map([[2, null], [0, 'a']]), () => true, true); -> true (a match holding null counts)
1407
+ * dataContains(new Map([[1, 'a'], ['1', 'b']]), 'a'); -> false
1408
+ */
1409
+ export declare const dataContains: ((data: ReadonlyMap<unknown, unknown>, key: PathKey | ((value: unknown, key: PropertyKey) => unknown), value: string | number | bigint | symbol | object | null | undefined) => boolean) & typeof arrContains & typeof objContains;
1410
+ /**
1411
+ * Determine if data contains a value, using strict comparison.
1412
+ *
1413
+ * A Map is read in its insertion order, so a callback is handed its keys in the order PHP
1414
+ * walks the array, and the keys PHP stores as one (`1` and `"1"`) hold only the last value.
1415
+ *
1416
+ * @param data - The data to search
1417
+ * @param key - The value to search for, a callback, or the dot path to compare when `value` is given; the path takes
1418
+ * no `*` wildcard, where PHP's `data_get` reads one
1419
+ * @param value - The value the path must strictly equal
1420
+ * @returns True if a match is found, false otherwise
1421
+ *
1422
+ * @example
1423
+ *
1424
+ * dataContainsStrict([1, 3, 5, '02'], '02'); -> true
1425
+ * dataContainsStrict([1, 3, 5, '02'], 2); -> false
1426
+ * dataContainsStrict({ a: 1, b: null }, (value) => value === null); -> true
1427
+ * dataContainsStrict([{ tags: ['a', 'b'] }], 'tags', ['a', 'b']); -> true
1428
+ * dataContainsStrict([{ user: { id: 2 } }], 'user.id', 2); -> true
1429
+ */
1430
+ export declare const dataContainsStrict: ((data: ReadonlyMap<unknown, unknown>, key: {} | ((value: unknown, key: string | number) => unknown) | null | undefined, value?: unknown) => boolean) & typeof arrContainsStrict & typeof objContainsStrict;
1431
+ /**
1432
+ * Get the differences between data collections.
1433
+ *
1434
+ * Both backings normalize `other` through `arrayableValues`, so a mismatched
1435
+ * shape, a scalar, and `null`/`undefined` are all defined behaviour rather than
1436
+ * an error.
1437
+ *
1438
+ * @param data - The source data
1439
+ * @param other - The data to compare against
1440
+ * @returns Data with differences, preserving structure
1441
+ *
1442
+ * @example
1443
+ *
1444
+ * dataDiff([1, 2, 3, 4], [2, 4]); -> [1, 3]
1445
+ */
1446
+ export declare const dataDiff: ((data: ReadonlyMap<unknown, unknown>, other: unknown) => Record<string, unknown>) & typeof arrDiff & typeof objDiff;
1447
+ /**
1448
+ * Get the items whose key and value are not both present in the given other data.
1449
+ *
1450
+ * Unlike `dataDiff`, this doesn't normalize `other` through `arrayableValues` —
1451
+ * a key on `other` with a different value is what keeps the item, so `other`'s
1452
+ * own keys matter here, not just its values.
1453
+ *
1454
+ * @param data - The source data
1455
+ * @param other - The data to compare against
1456
+ * @returns Data with differences, preserving structure
1457
+ *
1458
+ * @example
1459
+ *
1460
+ * dataDiffAssoc({a: 1, b: 2, c: 3}, {b: 2}); -> {a: 1, c: 3}
1461
+ */
1462
+ export declare const dataDiffAssoc: ((data: ReadonlyMap<unknown, unknown>, other: unknown) => Record<string, unknown>) & typeof arrDiffAssoc & typeof objDiffAssoc;
1463
+ /**
1464
+ * Get the items whose keys are not present in the given other data.
1465
+ *
1466
+ * `other` is read by its own keys, so a list holds its indexes and never its `length`. A list's survivors renumber.
1467
+ *
1468
+ * @param data - The source data
1469
+ * @param other - The data whose keys to diff against
1470
+ * @returns Data holding the items whose key `other` lacks, matching the delegate's own result
1471
+ *
1472
+ * @example
1473
+ *
1474
+ * dataDiffKeys({id: 1, first_word: 'Hello'}, {id: 123, foo_bar: 'Hello'}); -> {first_word: 'Hello'}
1475
+ * dataDiffKeys([1, 2, 3], [9, 9]); -> [3]
1476
+ */
1477
+ export declare const dataDiffKeys: ((data: ReadonlyMap<unknown, unknown>, other: unknown) => Record<string, unknown>) & typeof arrDiffKeys & typeof objDiffKeys;
1478
+ /**
1479
+ * Get the items whose value is not present in the given other data, comparing with the callback.
1480
+ *
1481
+ * The callback reports whether two values are equal. A list's survivors renumber.
1482
+ *
1483
+ * @param data - The source data
1484
+ * @param other - The data to diff against
1485
+ * @param callback - Function that reports whether a value of `data` equals a value of `other`
1486
+ * @returns Data holding the items no value of `other` equals, matching the delegate's own result
1487
+ *
1488
+ * @example
1489
+ *
1490
+ * const strcasecmp = (a: unknown, b: unknown) => String(a).toLowerCase() === String(b).toLowerCase();
1491
+ * dataDiffUsing(['green', 'brown', 'blue'], ['GREEN', 'yellow'], strcasecmp); -> ['brown', 'blue']
1492
+ */
1493
+ export declare const dataDiffUsing: ((data: ReadonlyMap<unknown, unknown>, other: unknown, callable: (a: unknown, b: unknown) => boolean) => Record<string, unknown>) & typeof arrDiffUsing & typeof objDiffUsing;
1494
+ /**
1495
+ * Diff data with the given other data using a callback for key comparison.
1496
+ * Compares keys using the callback and values using PHP's `(string)` cast rule.
1497
+ * A list's keys are its indices, so `other` is read through `arrayableItems` on
1498
+ * both backings and a list's survivors are reindexed.
1499
+ *
1500
+ * @param data - The data to diff
1501
+ * @param other - The data to diff against
1502
+ * @param callback - Function to compare keys (returns true if keys match)
1503
+ * @returns Diff result maintaining appropriate structure
1504
+ *
1505
+ * @example
1506
+ *
1507
+ * const strcasecmp = (a: unknown, b: unknown) => String(a).toLowerCase() === String(b).toLowerCase();
1508
+ * dataDiffAssocUsing({a: 'green', b: 'brown'}, {A: 'green', c: 'blue'}, strcasecmp); -> {b: 'brown'}
1509
+ */
1510
+ export declare const dataDiffAssocUsing: ((data: ReadonlyMap<unknown, unknown>, other: unknown, callback: (keyA: string | number, keyB: string | number) => boolean) => Record<string, unknown>) & typeof arrDiffAssocUsing & typeof objDiffAssocUsing;
1511
+ /**
1512
+ * Diff data keys with the given other data using a callback for key comparison only.
1513
+ * Compares keys using the callback and ignores values completely.
1514
+ * A list's keys are its indices, so `other` is read through `arrayableItems` on
1515
+ * both backings and a list's survivors are reindexed.
1516
+ *
1517
+ * @param data - The data to diff
1518
+ * @param other - The data to diff against
1519
+ * @param callback - Function to compare keys (returns true if keys match)
1520
+ * @returns Diff result maintaining appropriate structure
1521
+ *
1522
+ * @example
1523
+ *
1524
+ * const strcasecmp = (a: unknown, b: unknown) => String(a).toLowerCase() === String(b).toLowerCase();
1525
+ * dataDiffKeysUsing({id: 1, first_word: 'Hello'}, {ID: 123, foo_bar: 'Hello'}, strcasecmp); -> {first_word: 'Hello'}
1526
+ */
1527
+ export declare const dataDiffKeysUsing: ((data: ReadonlyMap<unknown, unknown>, other: unknown, callback: (keyA: string | number, keyB: string | number) => boolean) => Record<string, unknown>) & typeof arrDiffKeysUsing & typeof objDiffKeysUsing;
1528
+ /**
1529
+ * Pluck values from data by a key path.
1530
+ *
1531
+ * A Map is walked in its insertion order, so the list and both callbacks follow PHP's order, and of two items that
1532
+ * resolve to one key the last is kept. A keyed result is still a plain object, whose integer keys list ascending.
1533
+ *
1534
+ * @param data - The data to pluck from
1535
+ * @param value - The key path to pluck
1536
+ * @param key - Optional key path to use as keys in result
1537
+ * @returns Plucked values maintaining appropriate structure
1538
+ *
1539
+ * @example
1540
+ *
1541
+ * dataPluck([{name: 'John'}, {name: 'Jane'}], 'name'); -> ['John', 'Jane']
1542
+ * dataPluck({a: {name: 'John'}, b: {name: 'Jane'}}, 'name'); -> ['John', 'Jane']
1543
+ * dataPluck(new Map([[2, {n: 'c'}], [0, {n: 'a'}], [1, {n: 'b'}]]), 'n'); -> ['c', 'a', 'b']
1544
+ */
1545
+ export declare const dataPluck: ((data: ReadonlyMap<unknown, unknown>, value: string | readonly (string | number)[] | ((item: unknown) => unknown) | null | undefined, key?: (string | readonly (string | number)[] | ((item: unknown) => unknown)) | null | undefined) => unknown[] | Record<string | number, unknown>) & typeof arrPluck & typeof objPluck;
1546
+ /**
1547
+ * Get and remove the last N items from the data, mutating it in place.
1548
+ *
1549
+ * A count above one returns the items in reverse order. A Map is popped from the end of its insertion order.
1550
+ *
1551
+ * @param data - The data to pop from. Mutated in place for an array or record backing; a Map, Set
1552
+ * or generator backing is copied first, so the write lands on the copy and is discarded.
1553
+ * @param count - The number of items to pop; a fraction is dropped, and NAN pops every item
1554
+ * @returns The popped item(s), or null if the source had nothing to pop.
1555
+ * @throws Error for a fraction between 1 and 2 that the items do not cap, as PHP's range() throws its ValueError.
1556
+ *
1557
+ * @example
1558
+ *
1559
+ * dataPop([1, 2, 3]); -> 3
1560
+ * dataPop(new Map([[2, 'c'], [0, 'a'], [1, 'b']]), 2); -> ['b', 'a'], the Map left as it was
1561
+ */
1562
+ export declare const dataPop: ((data: ReadonlyMap<unknown, unknown>, count?: number | undefined) => unknown) & typeof arrPop & typeof objPop;
1563
+ /**
1564
+ * Intersect the data with the given items.
1565
+ *
1566
+ * Like `dataDiff`, both backings normalize `other` through `arrayableValues`,
1567
+ * so a mismatched shape, a scalar and `null`/`undefined` are all defined
1568
+ * behaviour — `array_intersect` compares by value only. The key-aware
1569
+ * `intersectAssoc*`/`intersectByKeys` siblings still require matching shapes.
1570
+ *
1571
+ * @param data - The original data
1572
+ * @param items - The items to intersect with
1573
+ * @param callable - Optional comparison function
1574
+ * @returns The intersected data
1575
+ */
1576
+ export declare const dataIntersect: ((data: ReadonlyMap<unknown, unknown>, other: unknown, callable?: ((a: unknown, b: unknown) => boolean) | null | undefined) => Record<string, unknown>) & typeof arrIntersect & typeof objIntersect;
1577
+ /**
1578
+ * Intersect the data with the given items, comparing values with the callback.
1579
+ *
1580
+ * The callback reports whether two values are equal.
1581
+ *
1582
+ * @param data - The original data
1583
+ * @param items - The items to intersect with
1584
+ * @param callback - Function that reports whether a value of `data` equals a value of `items`
1585
+ * @returns Data holding the items some value of `items` equals, matching the delegate's own result
1586
+ *
1587
+ * @example
1588
+ *
1589
+ * const strcasecmp = (a: unknown, b: unknown) => String(a).toLowerCase() === String(b).toLowerCase();
1590
+ * dataIntersectUsing({a: 'green', b: 'brown'}, {A: 'GREEN'}, strcasecmp); -> {a: 'green'}
1591
+ */
1592
+ export declare const dataIntersectUsing: ((data: ReadonlyMap<unknown, unknown>, other: unknown, callable: (a: unknown, b: unknown) => boolean) => Record<string, unknown>) & typeof arrIntersectUsing & typeof objIntersectUsing;
1593
+ /**
1594
+ * Intersect the data with the given items with additional key check.
1595
+ * Returns items where both the key AND value match.
1596
+ *
1597
+ * `data`'s backing picks the helper, and `other` may be a list or an object on either backing,
1598
+ * as `array_intersect_assoc` takes any two arrays. A `null`/`undefined` `other` is treated as empty.
1599
+ *
1600
+ * @param data - The original data
1601
+ * @param items - The items to intersect with
1602
+ * @returns The intersected data
1603
+ *
1604
+ * @example
1605
+ *
1606
+ * dataIntersectAssoc({a: 'green', b: 'brown'}, {a: 'green', b: 'yellow'}); -> {a: 'green'}
1607
+ * dataIntersectAssoc([1, 2, 3], [2, 3, 4]); -> []
1608
+ */
1609
+ export declare const dataIntersectAssoc: ((data: ReadonlyMap<unknown, unknown>, other: unknown) => Record<string, unknown>) & typeof arrIntersectAssoc & typeof objIntersectAssoc;
1610
+ /**
1611
+ * Intersect the data with the given items with additional key check, using the callback.
1612
+ * The callback is used to compare keys, while values are compared by PHP's `(string)` cast rule.
1613
+ * `other` may be a list or an object on either backing.
1614
+ *
1615
+ * @param data - The original data
1616
+ * @param items - The items to intersect with
1617
+ * @param callback - The callback function to compare keys (returns true if keys match)
1618
+ * @returns The intersected data
1619
+ *
1620
+ * @example
1621
+ *
1622
+ * const strcasecmpKeys = (a, b) => String(a).toLowerCase() === String(b).toLowerCase();
1623
+ * dataIntersectAssocUsing({a: 'green', b: 'brown'}, {A: 'GREEN', B: 'brown'}, strcasecmpKeys); -> {b: 'brown'}
1624
+ */
1625
+ export declare const dataIntersectAssocUsing: ((data: ReadonlyMap<unknown, unknown>, other: unknown, callback: (keyA: string | number, keyB: string | number) => boolean) => Record<string, unknown>) & typeof arrIntersectAssocUsing & typeof objIntersectAssocUsing;
1626
+ /**
1627
+ * Intersect the data with the given items by key.
1628
+ * `other` may be a list or an object on either backing, as `array_intersect_key` takes any two arrays.
1629
+ *
1630
+ * @param data - The original data
1631
+ * @param items - The items to intersect with
1632
+ * @returns The intersected data
1633
+ */
1634
+ export declare const dataIntersectByKeys: ((data: ReadonlyMap<unknown, unknown>, other: unknown) => Record<string, unknown>) & typeof arrIntersectByKeys & typeof objIntersectByKeys;
1635
+ export {};
1636
+ //# sourceMappingURL=data.d.ts.map