@andrew_l/toolkit 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -114,23 +114,6 @@ declare function chunkSeries(list: number[], step?: number): number[][];
114
114
  */
115
115
  declare function difference<T>(...arrays: readonly T[][]): T[];
116
116
 
117
- /**
118
- * Returns the intersection of arrays.
119
- *
120
- * This function takes arrays and returns a new array containing the elements that are
121
- * present in all arrays.
122
- *
123
- * @template T - The type of elements in the array.
124
- * @returns {T[]} A new array containing the elements that are present in both arrays.
125
- *
126
- * @example
127
- * const array1 = [1, 2, 3, 4, 5];
128
- * const array2 = [3, 4, 5, 6, 7];
129
- * const result = intersection(array1, array2);
130
- * // result will be [3, 4, 5] since these elements are in both arrays.
131
- */
132
- declare function intersection<T>(...arrays: readonly T[][]): T[];
133
-
134
117
  type MaybePropertyKey<T> = T extends object
135
118
  ? keyof T | PropertyKey
136
119
  : PropertyKey;
@@ -149,6 +132,28 @@ type IsPropertyKey<T, V, L> = T extends object
149
132
  : L
150
133
  : PropertyKeyLiteralToType<L>;
151
134
 
135
+ declare function groupBy<T, K extends MaybePropertyKey<T>>(array: readonly T[], keyBy: K, objectMode?: false): Map<IsPropertyKey<T, K, K>, T[]>;
136
+ declare function groupBy<T, K>(array: readonly T[], keyBy: (item: T) => K, objectMode?: false): Map<K, T[]>;
137
+ declare function groupBy<T, K extends MaybePropertyKey<T>>(array: readonly T[], keyBy: K, objectMode: true): Record<K, T[]>;
138
+ declare function groupBy<T, K extends PropertyKey>(array: readonly T[], keyBy: (item: T) => K, objectMode: true): Record<K, T[]>;
139
+
140
+ /**
141
+ * Returns the intersection of arrays.
142
+ *
143
+ * This function takes arrays and returns a new array containing the elements that are
144
+ * present in all arrays.
145
+ *
146
+ * @template T - The type of elements in the array.
147
+ * @returns {T[]} A new array containing the elements that are present in both arrays.
148
+ *
149
+ * @example
150
+ * const array1 = [1, 2, 3, 4, 5];
151
+ * const array2 = [3, 4, 5, 6, 7];
152
+ * const result = intersection(array1, array2);
153
+ * // result will be [3, 4, 5] since these elements are in both arrays.
154
+ */
155
+ declare function intersection<T>(...arrays: readonly T[][]): T[];
156
+
152
157
  /**
153
158
  * Maps each element of an array based on a provided key.
154
159
  *
@@ -316,13 +321,45 @@ declare function uniq<T extends any[]>(value: T): T;
316
321
  */
317
322
  declare function uniqBy<T>(array: T[], comparator: ((value: T) => any) | PropertyKey): T[];
318
323
 
324
+ type WrrItem<T> = {
325
+ item: T;
326
+ weight?: number;
327
+ };
328
+ /**
329
+ * Creates a function that returns a weighted round-robin item from the provided array.
330
+ *
331
+ * The input array should contain objects with an `item` property and a `weight` property.
332
+ * The `weight` determines the relative likelihood of selecting an item.
333
+ * Items with higher weights will appear more frequently in the selection.
334
+ *
335
+ * If the `weight` property is missing or falsy, it defaults to `1`.
336
+ * An empty array will result in a function that always returns `undefined`.
337
+ *
338
+ * @example
339
+ * const getItem = weightedRoundRobin([
340
+ * { item: 'a', weight: 2 },
341
+ * { item: 'b', weight: 3 },
342
+ * { item: 'c' },
343
+ * ]);
344
+ *
345
+ * console.log(getItem()); // 'a', 'b', or 'c'
346
+ *
347
+ * @group Array
348
+ */
349
+ declare function weightedRoundRobin<T = unknown>(arr: WrrItem<T>[]): () => T;
350
+
319
351
  declare function ok(value: unknown, message?: string | Error): asserts value;
320
352
  declare function equal<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
353
+ declare function empty(value: unknown, message?: string | Error): asserts value;
321
354
  declare function object(value: unknown, message?: string | Error): asserts value is object;
322
355
  declare function string(value: unknown, message?: string | Error): asserts value is string;
323
356
  declare function boolean(value: unknown, message?: string | Error): asserts value is boolean;
324
357
  declare function notEmptyString(value: unknown, message?: string | Error): asserts value is string;
325
358
  declare function number(value: unknown, message?: string | Error): asserts value is number;
359
+ declare function date(value: unknown, message?: string | Error): asserts value is Date;
360
+ declare function fn(value: unknown, message?: string | Error): asserts value is Function;
361
+ declare function greaterThan(value: unknown, target: number, message?: string | Error): asserts value is number;
362
+ declare function lessThan(value: unknown, target: number, message?: string | Error): asserts value is number;
326
363
  /**
327
364
  * @param {unknown} value
328
365
  * @param {string | Error} [message]
@@ -336,14 +373,19 @@ declare const assert_array: typeof array;
336
373
  declare const assert_arrayNumbers: typeof arrayNumbers;
337
374
  declare const assert_arrayStrings: typeof arrayStrings;
338
375
  declare const assert_boolean: typeof boolean;
376
+ declare const assert_date: typeof date;
377
+ declare const assert_empty: typeof empty;
339
378
  declare const assert_equal: typeof equal;
379
+ declare const assert_fn: typeof fn;
380
+ declare const assert_greaterThan: typeof greaterThan;
381
+ declare const assert_lessThan: typeof lessThan;
340
382
  declare const assert_notEmptyString: typeof notEmptyString;
341
383
  declare const assert_number: typeof number;
342
384
  declare const assert_object: typeof object;
343
385
  declare const assert_ok: typeof ok;
344
386
  declare const assert_string: typeof string;
345
387
  declare namespace assert {
346
- export { assert_array as array, assert_arrayNumbers as arrayNumbers, assert_arrayStrings as arrayStrings, assert_boolean as boolean, assert_equal as equal, assert_notEmptyString as notEmptyString, assert_number as number, assert_object as object, assert_ok as ok, assert_string as string };
388
+ export { assert_array as array, assert_arrayNumbers as arrayNumbers, assert_arrayStrings as arrayStrings, assert_boolean as boolean, assert_date as date, assert_empty as empty, assert_equal as equal, assert_fn as fn, assert_greaterThan as greaterThan, assert_lessThan as lessThan, assert_notEmptyString as notEmptyString, assert_number as number, assert_object as object, assert_ok as ok, assert_string as string };
347
389
  }
348
390
 
349
391
  type Base64ToBytesOptions = {
@@ -695,9 +737,17 @@ type FunctionArgs<Args extends any[] = any[], Return = void> = (
695
737
  ...args: Args
696
738
  ) => Return;
697
739
 
698
- type DeepPartial<T> = T extends object
699
- ? { [P in keyof T]?: DeepPartial<T[P]> }
700
- : T;
740
+ type DeepPartial<T> = T extends Date
741
+ ? T
742
+ : T extends object
743
+ ? { [P in keyof T]?: DeepPartial<T[P]> }
744
+ : T;
745
+
746
+ type DeepReadonly<T> = T extends unknown[]
747
+ ? Readonly<T>
748
+ : T extends object
749
+ ? Readonly<{ [P in keyof T]: DeepReadonly<T[P]> }>
750
+ : Readonly<T>;
701
751
 
702
752
  type AnyFunction = (...args: any[]) => any;
703
753
 
@@ -2531,7 +2581,12 @@ declare function isSuccess<T extends ExecResult>(value: T): value is ExecResultT
2531
2581
  declare function isSkip<T extends ExecResult>(value: T): value is ExecResultToSkip<T>;
2532
2582
 
2533
2583
  /**
2534
- * Extracts file extension from filename or url link
2584
+ * Extract file extension from string
2585
+ *
2586
+ * @example
2587
+ * getFileExtension('Andrew L - CV.pdf'); // 'pdf'
2588
+ *
2589
+ * @group Files
2535
2590
  */
2536
2591
  declare function getFileExtension(name: string, withDot?: boolean): string | null;
2537
2592
 
@@ -2545,6 +2600,28 @@ declare function getFileExtension(name: string, withDot?: boolean): string | nul
2545
2600
  */
2546
2601
  declare function getFileName(value: string): string | null;
2547
2602
 
2603
+ /**
2604
+ * Filters an array of paths to retain only the most specific (deepest) paths,
2605
+ * removing any path that is a prefix of another path.
2606
+ *
2607
+ * @param {string[]} keys - An array of dot-separated string paths.
2608
+ * @returns {string[]} - A new array containing only the most specific paths.
2609
+ *
2610
+ * @example
2611
+ * const inputPaths = [
2612
+ * 'profile',
2613
+ * 'profile.basic',
2614
+ * 'profile.basic.fullName',
2615
+ * 'profile.updatedAt'
2616
+ * ];
2617
+ *
2618
+ * const result = getMostSpecificPaths(inputPaths);
2619
+ * console.log(result); // ['profile.basic.fullName', 'profile.updatedAt']
2620
+ *
2621
+ * @group Files
2622
+ */
2623
+ declare function getMostSpecificPaths(keys: string[]): string[];
2624
+
2548
2625
  /**
2549
2626
  * Converts bytes amount into human readably string
2550
2627
  *
@@ -3520,6 +3597,7 @@ interface FlattenOptions {
3520
3597
  * // { 'root-user-name': 'Jane', 'root-user-profile-age': 30 }
3521
3598
  *
3522
3599
  * @group Object
3600
+ * @author lukeed
3523
3601
  */
3524
3602
  declare function flatten(obj: Record<string, unknown>, { separator, initialPrefix, withArrays, isObjectCompare, }?: FlattenOptions): Record<string, unknown>;
3525
3603
 
@@ -3738,8 +3816,9 @@ declare const toMap: <T extends object>(obj: T) => Map<keyof T, T[keyof T]>;
3738
3816
  * // }
3739
3817
  *
3740
3818
  * @group Object
3819
+ * @author lukeed
3741
3820
  */
3742
- declare function unflatten(obj: object, separator?: string): {};
3821
+ declare function unflatten(input: object, separator?: string): any;
3743
3822
 
3744
3823
  /**
3745
3824
  * Same as `set` but unset by dot notation
@@ -4910,4 +4989,4 @@ declare function wrapText(value: string, maxLength?: number): string;
4910
4989
  */
4911
4990
  declare function toError<T>(value: T, unknownMessage?: string): T extends Error ? T : Error;
4912
4991
 
4913
- export { type AnyFunction, AppError, type ArgumentsType, type Arrayable, AsyncIterableQueue, type Awaitable, type Base64ToBytesOptions, BrowserAssertionError, type BytesToBase64Options, CancellablePromise, type CatchErrorResult, Color, type ColorChannels, ColorParser, type Data, type DateObject, type DateObjectInput, type DeepPartial, type Defer, instance as EJSON, EJSONStream, type EJSONStreamOptions, type EJSONStreamOptionsWithPayload, type EnvParser, type ExecResult, type ExecResultToSkip, type ExecResultToSuccess, type ExecSkip, type ExecSuccess, FindMean, FixedMap, FixedWeakMap, type Fn, type FormatMoney, type FormatNumber, type FunctionArgs, type GenericObject, type IfAny, type IsAny, type LiteralUnion, type Logger, LruCache, type Nothing, type OverwriteWith, type Prettify, type Primitive, type PromisifyFn, Queue, type RandomizerOptions, type RetryOnErrorConfig, type SelectOptionItem, type SelectOptions, type SimpleDefaultEventMap, SimpleEventEmitter, type SimpleEventMap, _default as TWEMOJI_REGEX, type ThemeConfig, TimeBucket, type TimeBucketOptions, type TimeObject, type TimeObjectInput, TimeSpan, type TimeSpanUnit, type TimeString, type TimeValue, type TimestampMsInput, type TypeOf, type TypeOfMap, type ValuesOfObject, type WithCache, type WithCacheBucketBatchOptions, type WithCacheBucketOptions, type WithCacheFixedOptions, type WithCacheLruOptions, type WithCacheOptions, type WithCachePointer, type WithCacheResult, type WithCacheStorage, type WithCustomizer, type WithCustomizerFactory, type WithCustomizerValue, alpha, arrayable, assert, asyncFilter, asyncFind, asyncForEach, asyncMap, avg, base64ToBytes, bigIntBytes, bigIntFromBytes, blendColors, buildCssColor, bytesToBase64, cache, cacheBucket, cacheFixed, cacheLRU, camelCase, capitalize, captureStackTrace, catchError, channelsToHSL, channelsToHex, channelsToRGB, checkBitmask, chunk, chunkSeries, clamp, cleanEmpty, cleanObject, colorToChannels, compareBytes, concatenateBytes, contrastRatio, convertToUnit, crc32, createCustomizer, createCustomizerFactory, createDateObject, createDeepCloneWith, createEJSON, createEJSONStream, createEnvParser, createRandomizer, createSecureCustomizer, createTimeObject, createTimeSpan, createWithCache, cssVariable, dateInDays, dateInSeconds, deepAssign, deepClone, deepCloneWith, deepDefaults, deepFreeze, def, defer, delay, difference, dropCache, env, escapeHtml, escapeNumeric, escapeRegExp, fastIdle, fastIdlePromise, fastRaf, findMean, flagsToMap, flatten, formatMoney, formatNumber, get, getFileExtension, getFileName, getInitials, getRandomInt, getRandomTime, getWords, has, hasOwn, hasProtocol, hex, hexToChannels, hmToSeconds, hslToChannels, humanFileSize, humanize, interpolateColor, intersection, isBigInt, isBoolean, isCached, isClient, isColorChannels, isCustomizerFactory, isDate, isDateObject, isDef, isEmpty, isEqual, isError, isFunction, isInfinity, isMap, isNullOrUndefined, isNumber, isObject, isOneEmoji, isPlainObject, isPrimitive, isPromise, isSet, isSkip, isString, isSuccess, isSymbol, isTimeObject, isTimeString, isTimeValue, isValidWeekDay, isWeakMap, isWeakSet, isWithCache, isoToFlagEmoji, kebabCase, keyBy, logger, lowerCase, luminance, maskingEmail, maskingPhone, maskingWords, nextTickIteration, noop, objectId, omit, omitPrefixed, orderBy, parseAllNumbers, parseAlpha, parsePercentage, percentOf, pick, pickPrefixed, qs, rafPromise, randomString, removeVS16s, retryOnError, rgbToChannels, round2digits, secondsToHm, set, shuffle, snakeCase, sprintf, startCase, strAssign, sum, timeFromMinutes, timeStringify, timeToMinutes, timeout, timestamp, timestampMs, timestampToDate, tintedTextColor, toError, toMap, truncate, typeOf, uint16ToUint8, uint32ToUint8, uint8ToUint16, uint8ToUint32, unflatten, union, uniq, uniqBy, unset, weeksInYear, withCache, withCacheBucket, withCacheBucketBatch, withCacheFixed, withCacheLRU, withDeepClone, withPointerCache, wrapText };
4992
+ export { type AnyFunction, AppError, type ArgumentsType, type Arrayable, AsyncIterableQueue, type Awaitable, type Base64ToBytesOptions, BrowserAssertionError, type BytesToBase64Options, CancellablePromise, type CatchErrorResult, Color, type ColorChannels, ColorParser, type Data, type DateObject, type DateObjectInput, type DeepPartial, type DeepReadonly, type Defer, instance as EJSON, EJSONStream, type EJSONStreamOptions, type EJSONStreamOptionsWithPayload, type EnvParser, type ExecResult, type ExecResultToSkip, type ExecResultToSuccess, type ExecSkip, type ExecSuccess, FindMean, FixedMap, FixedWeakMap, type Fn, type FormatMoney, type FormatNumber, type FunctionArgs, type GenericObject, type IfAny, type IsAny, type LiteralUnion, type Logger, LruCache, type Nothing, type OverwriteWith, type Prettify, type Primitive, type PromisifyFn, Queue, type RandomizerOptions, type RetryOnErrorConfig, type SelectOptionItem, type SelectOptions, type SimpleDefaultEventMap, SimpleEventEmitter, type SimpleEventMap, _default as TWEMOJI_REGEX, type ThemeConfig, TimeBucket, type TimeBucketOptions, type TimeObject, type TimeObjectInput, TimeSpan, type TimeSpanUnit, type TimeString, type TimeValue, type TimestampMsInput, type TypeOf, type TypeOfMap, type ValuesOfObject, type WithCache, type WithCacheBucketBatchOptions, type WithCacheBucketOptions, type WithCacheFixedOptions, type WithCacheLruOptions, type WithCacheOptions, type WithCachePointer, type WithCacheResult, type WithCacheStorage, type WithCustomizer, type WithCustomizerFactory, type WithCustomizerValue, type WrrItem, alpha, arrayable, assert, asyncFilter, asyncFind, asyncForEach, asyncMap, avg, base64ToBytes, bigIntBytes, bigIntFromBytes, blendColors, buildCssColor, bytesToBase64, cache, cacheBucket, cacheFixed, cacheLRU, camelCase, capitalize, captureStackTrace, catchError, channelsToHSL, channelsToHex, channelsToRGB, checkBitmask, chunk, chunkSeries, clamp, cleanEmpty, cleanObject, colorToChannels, compareBytes, concatenateBytes, contrastRatio, convertToUnit, crc32, createCustomizer, createCustomizerFactory, createDateObject, createDeepCloneWith, createEJSON, createEJSONStream, createEnvParser, createRandomizer, createSecureCustomizer, createTimeObject, createTimeSpan, createWithCache, cssVariable, dateInDays, dateInSeconds, deepAssign, deepClone, deepCloneWith, deepDefaults, deepFreeze, def, defer, delay, difference, dropCache, env, escapeHtml, escapeNumeric, escapeRegExp, fastIdle, fastIdlePromise, fastRaf, findMean, flagsToMap, flatten, formatMoney, formatNumber, get, getFileExtension, getFileName, getInitials, getMostSpecificPaths, getRandomInt, getRandomTime, getWords, groupBy, has, hasOwn, hasProtocol, hex, hexToChannels, hmToSeconds, hslToChannels, humanFileSize, humanize, interpolateColor, intersection, isBigInt, isBoolean, isCached, isClient, isColorChannels, isCustomizerFactory, isDate, isDateObject, isDef, isEmpty, isEqual, isError, isFunction, isInfinity, isMap, isNullOrUndefined, isNumber, isObject, isOneEmoji, isPlainObject, isPrimitive, isPromise, isSet, isSkip, isString, isSuccess, isSymbol, isTimeObject, isTimeString, isTimeValue, isValidWeekDay, isWeakMap, isWeakSet, isWithCache, isoToFlagEmoji, kebabCase, keyBy, logger, lowerCase, luminance, maskingEmail, maskingPhone, maskingWords, nextTickIteration, noop, objectId, omit, omitPrefixed, orderBy, parseAllNumbers, parseAlpha, parsePercentage, percentOf, pick, pickPrefixed, qs, rafPromise, randomString, removeVS16s, retryOnError, rgbToChannels, round2digits, secondsToHm, set, shuffle, snakeCase, sprintf, startCase, strAssign, sum, timeFromMinutes, timeStringify, timeToMinutes, timeout, timestamp, timestampMs, timestampToDate, tintedTextColor, toError, toMap, truncate, typeOf, uint16ToUint8, uint32ToUint8, uint8ToUint16, uint8ToUint32, unflatten, union, uniq, uniqBy, unset, weeksInYear, weightedRoundRobin, withCache, withCacheBucket, withCacheBucketBatch, withCacheFixed, withCacheLRU, withDeepClone, withPointerCache, wrapText };
package/dist/index.d.mts CHANGED
@@ -114,23 +114,6 @@ declare function chunkSeries(list: number[], step?: number): number[][];
114
114
  */
115
115
  declare function difference<T>(...arrays: readonly T[][]): T[];
116
116
 
117
- /**
118
- * Returns the intersection of arrays.
119
- *
120
- * This function takes arrays and returns a new array containing the elements that are
121
- * present in all arrays.
122
- *
123
- * @template T - The type of elements in the array.
124
- * @returns {T[]} A new array containing the elements that are present in both arrays.
125
- *
126
- * @example
127
- * const array1 = [1, 2, 3, 4, 5];
128
- * const array2 = [3, 4, 5, 6, 7];
129
- * const result = intersection(array1, array2);
130
- * // result will be [3, 4, 5] since these elements are in both arrays.
131
- */
132
- declare function intersection<T>(...arrays: readonly T[][]): T[];
133
-
134
117
  type MaybePropertyKey<T> = T extends object
135
118
  ? keyof T | PropertyKey
136
119
  : PropertyKey;
@@ -149,6 +132,28 @@ type IsPropertyKey<T, V, L> = T extends object
149
132
  : L
150
133
  : PropertyKeyLiteralToType<L>;
151
134
 
135
+ declare function groupBy<T, K extends MaybePropertyKey<T>>(array: readonly T[], keyBy: K, objectMode?: false): Map<IsPropertyKey<T, K, K>, T[]>;
136
+ declare function groupBy<T, K>(array: readonly T[], keyBy: (item: T) => K, objectMode?: false): Map<K, T[]>;
137
+ declare function groupBy<T, K extends MaybePropertyKey<T>>(array: readonly T[], keyBy: K, objectMode: true): Record<K, T[]>;
138
+ declare function groupBy<T, K extends PropertyKey>(array: readonly T[], keyBy: (item: T) => K, objectMode: true): Record<K, T[]>;
139
+
140
+ /**
141
+ * Returns the intersection of arrays.
142
+ *
143
+ * This function takes arrays and returns a new array containing the elements that are
144
+ * present in all arrays.
145
+ *
146
+ * @template T - The type of elements in the array.
147
+ * @returns {T[]} A new array containing the elements that are present in both arrays.
148
+ *
149
+ * @example
150
+ * const array1 = [1, 2, 3, 4, 5];
151
+ * const array2 = [3, 4, 5, 6, 7];
152
+ * const result = intersection(array1, array2);
153
+ * // result will be [3, 4, 5] since these elements are in both arrays.
154
+ */
155
+ declare function intersection<T>(...arrays: readonly T[][]): T[];
156
+
152
157
  /**
153
158
  * Maps each element of an array based on a provided key.
154
159
  *
@@ -316,13 +321,45 @@ declare function uniq<T extends any[]>(value: T): T;
316
321
  */
317
322
  declare function uniqBy<T>(array: T[], comparator: ((value: T) => any) | PropertyKey): T[];
318
323
 
324
+ type WrrItem<T> = {
325
+ item: T;
326
+ weight?: number;
327
+ };
328
+ /**
329
+ * Creates a function that returns a weighted round-robin item from the provided array.
330
+ *
331
+ * The input array should contain objects with an `item` property and a `weight` property.
332
+ * The `weight` determines the relative likelihood of selecting an item.
333
+ * Items with higher weights will appear more frequently in the selection.
334
+ *
335
+ * If the `weight` property is missing or falsy, it defaults to `1`.
336
+ * An empty array will result in a function that always returns `undefined`.
337
+ *
338
+ * @example
339
+ * const getItem = weightedRoundRobin([
340
+ * { item: 'a', weight: 2 },
341
+ * { item: 'b', weight: 3 },
342
+ * { item: 'c' },
343
+ * ]);
344
+ *
345
+ * console.log(getItem()); // 'a', 'b', or 'c'
346
+ *
347
+ * @group Array
348
+ */
349
+ declare function weightedRoundRobin<T = unknown>(arr: WrrItem<T>[]): () => T;
350
+
319
351
  declare function ok(value: unknown, message?: string | Error): asserts value;
320
352
  declare function equal<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
353
+ declare function empty(value: unknown, message?: string | Error): asserts value;
321
354
  declare function object(value: unknown, message?: string | Error): asserts value is object;
322
355
  declare function string(value: unknown, message?: string | Error): asserts value is string;
323
356
  declare function boolean(value: unknown, message?: string | Error): asserts value is boolean;
324
357
  declare function notEmptyString(value: unknown, message?: string | Error): asserts value is string;
325
358
  declare function number(value: unknown, message?: string | Error): asserts value is number;
359
+ declare function date(value: unknown, message?: string | Error): asserts value is Date;
360
+ declare function fn(value: unknown, message?: string | Error): asserts value is Function;
361
+ declare function greaterThan(value: unknown, target: number, message?: string | Error): asserts value is number;
362
+ declare function lessThan(value: unknown, target: number, message?: string | Error): asserts value is number;
326
363
  /**
327
364
  * @param {unknown} value
328
365
  * @param {string | Error} [message]
@@ -336,14 +373,19 @@ declare const assert_array: typeof array;
336
373
  declare const assert_arrayNumbers: typeof arrayNumbers;
337
374
  declare const assert_arrayStrings: typeof arrayStrings;
338
375
  declare const assert_boolean: typeof boolean;
376
+ declare const assert_date: typeof date;
377
+ declare const assert_empty: typeof empty;
339
378
  declare const assert_equal: typeof equal;
379
+ declare const assert_fn: typeof fn;
380
+ declare const assert_greaterThan: typeof greaterThan;
381
+ declare const assert_lessThan: typeof lessThan;
340
382
  declare const assert_notEmptyString: typeof notEmptyString;
341
383
  declare const assert_number: typeof number;
342
384
  declare const assert_object: typeof object;
343
385
  declare const assert_ok: typeof ok;
344
386
  declare const assert_string: typeof string;
345
387
  declare namespace assert {
346
- export { assert_array as array, assert_arrayNumbers as arrayNumbers, assert_arrayStrings as arrayStrings, assert_boolean as boolean, assert_equal as equal, assert_notEmptyString as notEmptyString, assert_number as number, assert_object as object, assert_ok as ok, assert_string as string };
388
+ export { assert_array as array, assert_arrayNumbers as arrayNumbers, assert_arrayStrings as arrayStrings, assert_boolean as boolean, assert_date as date, assert_empty as empty, assert_equal as equal, assert_fn as fn, assert_greaterThan as greaterThan, assert_lessThan as lessThan, assert_notEmptyString as notEmptyString, assert_number as number, assert_object as object, assert_ok as ok, assert_string as string };
347
389
  }
348
390
 
349
391
  type Base64ToBytesOptions = {
@@ -695,9 +737,17 @@ type FunctionArgs<Args extends any[] = any[], Return = void> = (
695
737
  ...args: Args
696
738
  ) => Return;
697
739
 
698
- type DeepPartial<T> = T extends object
699
- ? { [P in keyof T]?: DeepPartial<T[P]> }
700
- : T;
740
+ type DeepPartial<T> = T extends Date
741
+ ? T
742
+ : T extends object
743
+ ? { [P in keyof T]?: DeepPartial<T[P]> }
744
+ : T;
745
+
746
+ type DeepReadonly<T> = T extends unknown[]
747
+ ? Readonly<T>
748
+ : T extends object
749
+ ? Readonly<{ [P in keyof T]: DeepReadonly<T[P]> }>
750
+ : Readonly<T>;
701
751
 
702
752
  type AnyFunction = (...args: any[]) => any;
703
753
 
@@ -2531,7 +2581,12 @@ declare function isSuccess<T extends ExecResult>(value: T): value is ExecResultT
2531
2581
  declare function isSkip<T extends ExecResult>(value: T): value is ExecResultToSkip<T>;
2532
2582
 
2533
2583
  /**
2534
- * Extracts file extension from filename or url link
2584
+ * Extract file extension from string
2585
+ *
2586
+ * @example
2587
+ * getFileExtension('Andrew L - CV.pdf'); // 'pdf'
2588
+ *
2589
+ * @group Files
2535
2590
  */
2536
2591
  declare function getFileExtension(name: string, withDot?: boolean): string | null;
2537
2592
 
@@ -2545,6 +2600,28 @@ declare function getFileExtension(name: string, withDot?: boolean): string | nul
2545
2600
  */
2546
2601
  declare function getFileName(value: string): string | null;
2547
2602
 
2603
+ /**
2604
+ * Filters an array of paths to retain only the most specific (deepest) paths,
2605
+ * removing any path that is a prefix of another path.
2606
+ *
2607
+ * @param {string[]} keys - An array of dot-separated string paths.
2608
+ * @returns {string[]} - A new array containing only the most specific paths.
2609
+ *
2610
+ * @example
2611
+ * const inputPaths = [
2612
+ * 'profile',
2613
+ * 'profile.basic',
2614
+ * 'profile.basic.fullName',
2615
+ * 'profile.updatedAt'
2616
+ * ];
2617
+ *
2618
+ * const result = getMostSpecificPaths(inputPaths);
2619
+ * console.log(result); // ['profile.basic.fullName', 'profile.updatedAt']
2620
+ *
2621
+ * @group Files
2622
+ */
2623
+ declare function getMostSpecificPaths(keys: string[]): string[];
2624
+
2548
2625
  /**
2549
2626
  * Converts bytes amount into human readably string
2550
2627
  *
@@ -3520,6 +3597,7 @@ interface FlattenOptions {
3520
3597
  * // { 'root-user-name': 'Jane', 'root-user-profile-age': 30 }
3521
3598
  *
3522
3599
  * @group Object
3600
+ * @author lukeed
3523
3601
  */
3524
3602
  declare function flatten(obj: Record<string, unknown>, { separator, initialPrefix, withArrays, isObjectCompare, }?: FlattenOptions): Record<string, unknown>;
3525
3603
 
@@ -3738,8 +3816,9 @@ declare const toMap: <T extends object>(obj: T) => Map<keyof T, T[keyof T]>;
3738
3816
  * // }
3739
3817
  *
3740
3818
  * @group Object
3819
+ * @author lukeed
3741
3820
  */
3742
- declare function unflatten(obj: object, separator?: string): {};
3821
+ declare function unflatten(input: object, separator?: string): any;
3743
3822
 
3744
3823
  /**
3745
3824
  * Same as `set` but unset by dot notation
@@ -4910,4 +4989,4 @@ declare function wrapText(value: string, maxLength?: number): string;
4910
4989
  */
4911
4990
  declare function toError<T>(value: T, unknownMessage?: string): T extends Error ? T : Error;
4912
4991
 
4913
- export { type AnyFunction, AppError, type ArgumentsType, type Arrayable, AsyncIterableQueue, type Awaitable, type Base64ToBytesOptions, BrowserAssertionError, type BytesToBase64Options, CancellablePromise, type CatchErrorResult, Color, type ColorChannels, ColorParser, type Data, type DateObject, type DateObjectInput, type DeepPartial, type Defer, instance as EJSON, EJSONStream, type EJSONStreamOptions, type EJSONStreamOptionsWithPayload, type EnvParser, type ExecResult, type ExecResultToSkip, type ExecResultToSuccess, type ExecSkip, type ExecSuccess, FindMean, FixedMap, FixedWeakMap, type Fn, type FormatMoney, type FormatNumber, type FunctionArgs, type GenericObject, type IfAny, type IsAny, type LiteralUnion, type Logger, LruCache, type Nothing, type OverwriteWith, type Prettify, type Primitive, type PromisifyFn, Queue, type RandomizerOptions, type RetryOnErrorConfig, type SelectOptionItem, type SelectOptions, type SimpleDefaultEventMap, SimpleEventEmitter, type SimpleEventMap, _default as TWEMOJI_REGEX, type ThemeConfig, TimeBucket, type TimeBucketOptions, type TimeObject, type TimeObjectInput, TimeSpan, type TimeSpanUnit, type TimeString, type TimeValue, type TimestampMsInput, type TypeOf, type TypeOfMap, type ValuesOfObject, type WithCache, type WithCacheBucketBatchOptions, type WithCacheBucketOptions, type WithCacheFixedOptions, type WithCacheLruOptions, type WithCacheOptions, type WithCachePointer, type WithCacheResult, type WithCacheStorage, type WithCustomizer, type WithCustomizerFactory, type WithCustomizerValue, alpha, arrayable, assert, asyncFilter, asyncFind, asyncForEach, asyncMap, avg, base64ToBytes, bigIntBytes, bigIntFromBytes, blendColors, buildCssColor, bytesToBase64, cache, cacheBucket, cacheFixed, cacheLRU, camelCase, capitalize, captureStackTrace, catchError, channelsToHSL, channelsToHex, channelsToRGB, checkBitmask, chunk, chunkSeries, clamp, cleanEmpty, cleanObject, colorToChannels, compareBytes, concatenateBytes, contrastRatio, convertToUnit, crc32, createCustomizer, createCustomizerFactory, createDateObject, createDeepCloneWith, createEJSON, createEJSONStream, createEnvParser, createRandomizer, createSecureCustomizer, createTimeObject, createTimeSpan, createWithCache, cssVariable, dateInDays, dateInSeconds, deepAssign, deepClone, deepCloneWith, deepDefaults, deepFreeze, def, defer, delay, difference, dropCache, env, escapeHtml, escapeNumeric, escapeRegExp, fastIdle, fastIdlePromise, fastRaf, findMean, flagsToMap, flatten, formatMoney, formatNumber, get, getFileExtension, getFileName, getInitials, getRandomInt, getRandomTime, getWords, has, hasOwn, hasProtocol, hex, hexToChannels, hmToSeconds, hslToChannels, humanFileSize, humanize, interpolateColor, intersection, isBigInt, isBoolean, isCached, isClient, isColorChannels, isCustomizerFactory, isDate, isDateObject, isDef, isEmpty, isEqual, isError, isFunction, isInfinity, isMap, isNullOrUndefined, isNumber, isObject, isOneEmoji, isPlainObject, isPrimitive, isPromise, isSet, isSkip, isString, isSuccess, isSymbol, isTimeObject, isTimeString, isTimeValue, isValidWeekDay, isWeakMap, isWeakSet, isWithCache, isoToFlagEmoji, kebabCase, keyBy, logger, lowerCase, luminance, maskingEmail, maskingPhone, maskingWords, nextTickIteration, noop, objectId, omit, omitPrefixed, orderBy, parseAllNumbers, parseAlpha, parsePercentage, percentOf, pick, pickPrefixed, qs, rafPromise, randomString, removeVS16s, retryOnError, rgbToChannels, round2digits, secondsToHm, set, shuffle, snakeCase, sprintf, startCase, strAssign, sum, timeFromMinutes, timeStringify, timeToMinutes, timeout, timestamp, timestampMs, timestampToDate, tintedTextColor, toError, toMap, truncate, typeOf, uint16ToUint8, uint32ToUint8, uint8ToUint16, uint8ToUint32, unflatten, union, uniq, uniqBy, unset, weeksInYear, withCache, withCacheBucket, withCacheBucketBatch, withCacheFixed, withCacheLRU, withDeepClone, withPointerCache, wrapText };
4992
+ export { type AnyFunction, AppError, type ArgumentsType, type Arrayable, AsyncIterableQueue, type Awaitable, type Base64ToBytesOptions, BrowserAssertionError, type BytesToBase64Options, CancellablePromise, type CatchErrorResult, Color, type ColorChannels, ColorParser, type Data, type DateObject, type DateObjectInput, type DeepPartial, type DeepReadonly, type Defer, instance as EJSON, EJSONStream, type EJSONStreamOptions, type EJSONStreamOptionsWithPayload, type EnvParser, type ExecResult, type ExecResultToSkip, type ExecResultToSuccess, type ExecSkip, type ExecSuccess, FindMean, FixedMap, FixedWeakMap, type Fn, type FormatMoney, type FormatNumber, type FunctionArgs, type GenericObject, type IfAny, type IsAny, type LiteralUnion, type Logger, LruCache, type Nothing, type OverwriteWith, type Prettify, type Primitive, type PromisifyFn, Queue, type RandomizerOptions, type RetryOnErrorConfig, type SelectOptionItem, type SelectOptions, type SimpleDefaultEventMap, SimpleEventEmitter, type SimpleEventMap, _default as TWEMOJI_REGEX, type ThemeConfig, TimeBucket, type TimeBucketOptions, type TimeObject, type TimeObjectInput, TimeSpan, type TimeSpanUnit, type TimeString, type TimeValue, type TimestampMsInput, type TypeOf, type TypeOfMap, type ValuesOfObject, type WithCache, type WithCacheBucketBatchOptions, type WithCacheBucketOptions, type WithCacheFixedOptions, type WithCacheLruOptions, type WithCacheOptions, type WithCachePointer, type WithCacheResult, type WithCacheStorage, type WithCustomizer, type WithCustomizerFactory, type WithCustomizerValue, type WrrItem, alpha, arrayable, assert, asyncFilter, asyncFind, asyncForEach, asyncMap, avg, base64ToBytes, bigIntBytes, bigIntFromBytes, blendColors, buildCssColor, bytesToBase64, cache, cacheBucket, cacheFixed, cacheLRU, camelCase, capitalize, captureStackTrace, catchError, channelsToHSL, channelsToHex, channelsToRGB, checkBitmask, chunk, chunkSeries, clamp, cleanEmpty, cleanObject, colorToChannels, compareBytes, concatenateBytes, contrastRatio, convertToUnit, crc32, createCustomizer, createCustomizerFactory, createDateObject, createDeepCloneWith, createEJSON, createEJSONStream, createEnvParser, createRandomizer, createSecureCustomizer, createTimeObject, createTimeSpan, createWithCache, cssVariable, dateInDays, dateInSeconds, deepAssign, deepClone, deepCloneWith, deepDefaults, deepFreeze, def, defer, delay, difference, dropCache, env, escapeHtml, escapeNumeric, escapeRegExp, fastIdle, fastIdlePromise, fastRaf, findMean, flagsToMap, flatten, formatMoney, formatNumber, get, getFileExtension, getFileName, getInitials, getMostSpecificPaths, getRandomInt, getRandomTime, getWords, groupBy, has, hasOwn, hasProtocol, hex, hexToChannels, hmToSeconds, hslToChannels, humanFileSize, humanize, interpolateColor, intersection, isBigInt, isBoolean, isCached, isClient, isColorChannels, isCustomizerFactory, isDate, isDateObject, isDef, isEmpty, isEqual, isError, isFunction, isInfinity, isMap, isNullOrUndefined, isNumber, isObject, isOneEmoji, isPlainObject, isPrimitive, isPromise, isSet, isSkip, isString, isSuccess, isSymbol, isTimeObject, isTimeString, isTimeValue, isValidWeekDay, isWeakMap, isWeakSet, isWithCache, isoToFlagEmoji, kebabCase, keyBy, logger, lowerCase, luminance, maskingEmail, maskingPhone, maskingWords, nextTickIteration, noop, objectId, omit, omitPrefixed, orderBy, parseAllNumbers, parseAlpha, parsePercentage, percentOf, pick, pickPrefixed, qs, rafPromise, randomString, removeVS16s, retryOnError, rgbToChannels, round2digits, secondsToHm, set, shuffle, snakeCase, sprintf, startCase, strAssign, sum, timeFromMinutes, timeStringify, timeToMinutes, timeout, timestamp, timestampMs, timestampToDate, tintedTextColor, toError, toMap, truncate, typeOf, uint16ToUint8, uint32ToUint8, uint8ToUint16, uint8ToUint32, unflatten, union, uniq, uniqBy, unset, weeksInYear, weightedRoundRobin, withCache, withCacheBucket, withCacheBucketBatch, withCacheFixed, withCacheLRU, withDeepClone, withPointerCache, wrapText };
package/dist/index.d.ts CHANGED
@@ -114,23 +114,6 @@ declare function chunkSeries(list: number[], step?: number): number[][];
114
114
  */
115
115
  declare function difference<T>(...arrays: readonly T[][]): T[];
116
116
 
117
- /**
118
- * Returns the intersection of arrays.
119
- *
120
- * This function takes arrays and returns a new array containing the elements that are
121
- * present in all arrays.
122
- *
123
- * @template T - The type of elements in the array.
124
- * @returns {T[]} A new array containing the elements that are present in both arrays.
125
- *
126
- * @example
127
- * const array1 = [1, 2, 3, 4, 5];
128
- * const array2 = [3, 4, 5, 6, 7];
129
- * const result = intersection(array1, array2);
130
- * // result will be [3, 4, 5] since these elements are in both arrays.
131
- */
132
- declare function intersection<T>(...arrays: readonly T[][]): T[];
133
-
134
117
  type MaybePropertyKey<T> = T extends object
135
118
  ? keyof T | PropertyKey
136
119
  : PropertyKey;
@@ -149,6 +132,28 @@ type IsPropertyKey<T, V, L> = T extends object
149
132
  : L
150
133
  : PropertyKeyLiteralToType<L>;
151
134
 
135
+ declare function groupBy<T, K extends MaybePropertyKey<T>>(array: readonly T[], keyBy: K, objectMode?: false): Map<IsPropertyKey<T, K, K>, T[]>;
136
+ declare function groupBy<T, K>(array: readonly T[], keyBy: (item: T) => K, objectMode?: false): Map<K, T[]>;
137
+ declare function groupBy<T, K extends MaybePropertyKey<T>>(array: readonly T[], keyBy: K, objectMode: true): Record<K, T[]>;
138
+ declare function groupBy<T, K extends PropertyKey>(array: readonly T[], keyBy: (item: T) => K, objectMode: true): Record<K, T[]>;
139
+
140
+ /**
141
+ * Returns the intersection of arrays.
142
+ *
143
+ * This function takes arrays and returns a new array containing the elements that are
144
+ * present in all arrays.
145
+ *
146
+ * @template T - The type of elements in the array.
147
+ * @returns {T[]} A new array containing the elements that are present in both arrays.
148
+ *
149
+ * @example
150
+ * const array1 = [1, 2, 3, 4, 5];
151
+ * const array2 = [3, 4, 5, 6, 7];
152
+ * const result = intersection(array1, array2);
153
+ * // result will be [3, 4, 5] since these elements are in both arrays.
154
+ */
155
+ declare function intersection<T>(...arrays: readonly T[][]): T[];
156
+
152
157
  /**
153
158
  * Maps each element of an array based on a provided key.
154
159
  *
@@ -316,13 +321,45 @@ declare function uniq<T extends any[]>(value: T): T;
316
321
  */
317
322
  declare function uniqBy<T>(array: T[], comparator: ((value: T) => any) | PropertyKey): T[];
318
323
 
324
+ type WrrItem<T> = {
325
+ item: T;
326
+ weight?: number;
327
+ };
328
+ /**
329
+ * Creates a function that returns a weighted round-robin item from the provided array.
330
+ *
331
+ * The input array should contain objects with an `item` property and a `weight` property.
332
+ * The `weight` determines the relative likelihood of selecting an item.
333
+ * Items with higher weights will appear more frequently in the selection.
334
+ *
335
+ * If the `weight` property is missing or falsy, it defaults to `1`.
336
+ * An empty array will result in a function that always returns `undefined`.
337
+ *
338
+ * @example
339
+ * const getItem = weightedRoundRobin([
340
+ * { item: 'a', weight: 2 },
341
+ * { item: 'b', weight: 3 },
342
+ * { item: 'c' },
343
+ * ]);
344
+ *
345
+ * console.log(getItem()); // 'a', 'b', or 'c'
346
+ *
347
+ * @group Array
348
+ */
349
+ declare function weightedRoundRobin<T = unknown>(arr: WrrItem<T>[]): () => T;
350
+
319
351
  declare function ok(value: unknown, message?: string | Error): asserts value;
320
352
  declare function equal<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
353
+ declare function empty(value: unknown, message?: string | Error): asserts value;
321
354
  declare function object(value: unknown, message?: string | Error): asserts value is object;
322
355
  declare function string(value: unknown, message?: string | Error): asserts value is string;
323
356
  declare function boolean(value: unknown, message?: string | Error): asserts value is boolean;
324
357
  declare function notEmptyString(value: unknown, message?: string | Error): asserts value is string;
325
358
  declare function number(value: unknown, message?: string | Error): asserts value is number;
359
+ declare function date(value: unknown, message?: string | Error): asserts value is Date;
360
+ declare function fn(value: unknown, message?: string | Error): asserts value is Function;
361
+ declare function greaterThan(value: unknown, target: number, message?: string | Error): asserts value is number;
362
+ declare function lessThan(value: unknown, target: number, message?: string | Error): asserts value is number;
326
363
  /**
327
364
  * @param {unknown} value
328
365
  * @param {string | Error} [message]
@@ -336,14 +373,19 @@ declare const assert_array: typeof array;
336
373
  declare const assert_arrayNumbers: typeof arrayNumbers;
337
374
  declare const assert_arrayStrings: typeof arrayStrings;
338
375
  declare const assert_boolean: typeof boolean;
376
+ declare const assert_date: typeof date;
377
+ declare const assert_empty: typeof empty;
339
378
  declare const assert_equal: typeof equal;
379
+ declare const assert_fn: typeof fn;
380
+ declare const assert_greaterThan: typeof greaterThan;
381
+ declare const assert_lessThan: typeof lessThan;
340
382
  declare const assert_notEmptyString: typeof notEmptyString;
341
383
  declare const assert_number: typeof number;
342
384
  declare const assert_object: typeof object;
343
385
  declare const assert_ok: typeof ok;
344
386
  declare const assert_string: typeof string;
345
387
  declare namespace assert {
346
- export { assert_array as array, assert_arrayNumbers as arrayNumbers, assert_arrayStrings as arrayStrings, assert_boolean as boolean, assert_equal as equal, assert_notEmptyString as notEmptyString, assert_number as number, assert_object as object, assert_ok as ok, assert_string as string };
388
+ export { assert_array as array, assert_arrayNumbers as arrayNumbers, assert_arrayStrings as arrayStrings, assert_boolean as boolean, assert_date as date, assert_empty as empty, assert_equal as equal, assert_fn as fn, assert_greaterThan as greaterThan, assert_lessThan as lessThan, assert_notEmptyString as notEmptyString, assert_number as number, assert_object as object, assert_ok as ok, assert_string as string };
347
389
  }
348
390
 
349
391
  type Base64ToBytesOptions = {
@@ -695,9 +737,17 @@ type FunctionArgs<Args extends any[] = any[], Return = void> = (
695
737
  ...args: Args
696
738
  ) => Return;
697
739
 
698
- type DeepPartial<T> = T extends object
699
- ? { [P in keyof T]?: DeepPartial<T[P]> }
700
- : T;
740
+ type DeepPartial<T> = T extends Date
741
+ ? T
742
+ : T extends object
743
+ ? { [P in keyof T]?: DeepPartial<T[P]> }
744
+ : T;
745
+
746
+ type DeepReadonly<T> = T extends unknown[]
747
+ ? Readonly<T>
748
+ : T extends object
749
+ ? Readonly<{ [P in keyof T]: DeepReadonly<T[P]> }>
750
+ : Readonly<T>;
701
751
 
702
752
  type AnyFunction = (...args: any[]) => any;
703
753
 
@@ -2531,7 +2581,12 @@ declare function isSuccess<T extends ExecResult>(value: T): value is ExecResultT
2531
2581
  declare function isSkip<T extends ExecResult>(value: T): value is ExecResultToSkip<T>;
2532
2582
 
2533
2583
  /**
2534
- * Extracts file extension from filename or url link
2584
+ * Extract file extension from string
2585
+ *
2586
+ * @example
2587
+ * getFileExtension('Andrew L - CV.pdf'); // 'pdf'
2588
+ *
2589
+ * @group Files
2535
2590
  */
2536
2591
  declare function getFileExtension(name: string, withDot?: boolean): string | null;
2537
2592
 
@@ -2545,6 +2600,28 @@ declare function getFileExtension(name: string, withDot?: boolean): string | nul
2545
2600
  */
2546
2601
  declare function getFileName(value: string): string | null;
2547
2602
 
2603
+ /**
2604
+ * Filters an array of paths to retain only the most specific (deepest) paths,
2605
+ * removing any path that is a prefix of another path.
2606
+ *
2607
+ * @param {string[]} keys - An array of dot-separated string paths.
2608
+ * @returns {string[]} - A new array containing only the most specific paths.
2609
+ *
2610
+ * @example
2611
+ * const inputPaths = [
2612
+ * 'profile',
2613
+ * 'profile.basic',
2614
+ * 'profile.basic.fullName',
2615
+ * 'profile.updatedAt'
2616
+ * ];
2617
+ *
2618
+ * const result = getMostSpecificPaths(inputPaths);
2619
+ * console.log(result); // ['profile.basic.fullName', 'profile.updatedAt']
2620
+ *
2621
+ * @group Files
2622
+ */
2623
+ declare function getMostSpecificPaths(keys: string[]): string[];
2624
+
2548
2625
  /**
2549
2626
  * Converts bytes amount into human readably string
2550
2627
  *
@@ -3520,6 +3597,7 @@ interface FlattenOptions {
3520
3597
  * // { 'root-user-name': 'Jane', 'root-user-profile-age': 30 }
3521
3598
  *
3522
3599
  * @group Object
3600
+ * @author lukeed
3523
3601
  */
3524
3602
  declare function flatten(obj: Record<string, unknown>, { separator, initialPrefix, withArrays, isObjectCompare, }?: FlattenOptions): Record<string, unknown>;
3525
3603
 
@@ -3738,8 +3816,9 @@ declare const toMap: <T extends object>(obj: T) => Map<keyof T, T[keyof T]>;
3738
3816
  * // }
3739
3817
  *
3740
3818
  * @group Object
3819
+ * @author lukeed
3741
3820
  */
3742
- declare function unflatten(obj: object, separator?: string): {};
3821
+ declare function unflatten(input: object, separator?: string): any;
3743
3822
 
3744
3823
  /**
3745
3824
  * Same as `set` but unset by dot notation
@@ -4910,4 +4989,4 @@ declare function wrapText(value: string, maxLength?: number): string;
4910
4989
  */
4911
4990
  declare function toError<T>(value: T, unknownMessage?: string): T extends Error ? T : Error;
4912
4991
 
4913
- export { type AnyFunction, AppError, type ArgumentsType, type Arrayable, AsyncIterableQueue, type Awaitable, type Base64ToBytesOptions, BrowserAssertionError, type BytesToBase64Options, CancellablePromise, type CatchErrorResult, Color, type ColorChannels, ColorParser, type Data, type DateObject, type DateObjectInput, type DeepPartial, type Defer, instance as EJSON, EJSONStream, type EJSONStreamOptions, type EJSONStreamOptionsWithPayload, type EnvParser, type ExecResult, type ExecResultToSkip, type ExecResultToSuccess, type ExecSkip, type ExecSuccess, FindMean, FixedMap, FixedWeakMap, type Fn, type FormatMoney, type FormatNumber, type FunctionArgs, type GenericObject, type IfAny, type IsAny, type LiteralUnion, type Logger, LruCache, type Nothing, type OverwriteWith, type Prettify, type Primitive, type PromisifyFn, Queue, type RandomizerOptions, type RetryOnErrorConfig, type SelectOptionItem, type SelectOptions, type SimpleDefaultEventMap, SimpleEventEmitter, type SimpleEventMap, _default as TWEMOJI_REGEX, type ThemeConfig, TimeBucket, type TimeBucketOptions, type TimeObject, type TimeObjectInput, TimeSpan, type TimeSpanUnit, type TimeString, type TimeValue, type TimestampMsInput, type TypeOf, type TypeOfMap, type ValuesOfObject, type WithCache, type WithCacheBucketBatchOptions, type WithCacheBucketOptions, type WithCacheFixedOptions, type WithCacheLruOptions, type WithCacheOptions, type WithCachePointer, type WithCacheResult, type WithCacheStorage, type WithCustomizer, type WithCustomizerFactory, type WithCustomizerValue, alpha, arrayable, assert, asyncFilter, asyncFind, asyncForEach, asyncMap, avg, base64ToBytes, bigIntBytes, bigIntFromBytes, blendColors, buildCssColor, bytesToBase64, cache, cacheBucket, cacheFixed, cacheLRU, camelCase, capitalize, captureStackTrace, catchError, channelsToHSL, channelsToHex, channelsToRGB, checkBitmask, chunk, chunkSeries, clamp, cleanEmpty, cleanObject, colorToChannels, compareBytes, concatenateBytes, contrastRatio, convertToUnit, crc32, createCustomizer, createCustomizerFactory, createDateObject, createDeepCloneWith, createEJSON, createEJSONStream, createEnvParser, createRandomizer, createSecureCustomizer, createTimeObject, createTimeSpan, createWithCache, cssVariable, dateInDays, dateInSeconds, deepAssign, deepClone, deepCloneWith, deepDefaults, deepFreeze, def, defer, delay, difference, dropCache, env, escapeHtml, escapeNumeric, escapeRegExp, fastIdle, fastIdlePromise, fastRaf, findMean, flagsToMap, flatten, formatMoney, formatNumber, get, getFileExtension, getFileName, getInitials, getRandomInt, getRandomTime, getWords, has, hasOwn, hasProtocol, hex, hexToChannels, hmToSeconds, hslToChannels, humanFileSize, humanize, interpolateColor, intersection, isBigInt, isBoolean, isCached, isClient, isColorChannels, isCustomizerFactory, isDate, isDateObject, isDef, isEmpty, isEqual, isError, isFunction, isInfinity, isMap, isNullOrUndefined, isNumber, isObject, isOneEmoji, isPlainObject, isPrimitive, isPromise, isSet, isSkip, isString, isSuccess, isSymbol, isTimeObject, isTimeString, isTimeValue, isValidWeekDay, isWeakMap, isWeakSet, isWithCache, isoToFlagEmoji, kebabCase, keyBy, logger, lowerCase, luminance, maskingEmail, maskingPhone, maskingWords, nextTickIteration, noop, objectId, omit, omitPrefixed, orderBy, parseAllNumbers, parseAlpha, parsePercentage, percentOf, pick, pickPrefixed, qs, rafPromise, randomString, removeVS16s, retryOnError, rgbToChannels, round2digits, secondsToHm, set, shuffle, snakeCase, sprintf, startCase, strAssign, sum, timeFromMinutes, timeStringify, timeToMinutes, timeout, timestamp, timestampMs, timestampToDate, tintedTextColor, toError, toMap, truncate, typeOf, uint16ToUint8, uint32ToUint8, uint8ToUint16, uint8ToUint32, unflatten, union, uniq, uniqBy, unset, weeksInYear, withCache, withCacheBucket, withCacheBucketBatch, withCacheFixed, withCacheLRU, withDeepClone, withPointerCache, wrapText };
4992
+ export { type AnyFunction, AppError, type ArgumentsType, type Arrayable, AsyncIterableQueue, type Awaitable, type Base64ToBytesOptions, BrowserAssertionError, type BytesToBase64Options, CancellablePromise, type CatchErrorResult, Color, type ColorChannels, ColorParser, type Data, type DateObject, type DateObjectInput, type DeepPartial, type DeepReadonly, type Defer, instance as EJSON, EJSONStream, type EJSONStreamOptions, type EJSONStreamOptionsWithPayload, type EnvParser, type ExecResult, type ExecResultToSkip, type ExecResultToSuccess, type ExecSkip, type ExecSuccess, FindMean, FixedMap, FixedWeakMap, type Fn, type FormatMoney, type FormatNumber, type FunctionArgs, type GenericObject, type IfAny, type IsAny, type LiteralUnion, type Logger, LruCache, type Nothing, type OverwriteWith, type Prettify, type Primitive, type PromisifyFn, Queue, type RandomizerOptions, type RetryOnErrorConfig, type SelectOptionItem, type SelectOptions, type SimpleDefaultEventMap, SimpleEventEmitter, type SimpleEventMap, _default as TWEMOJI_REGEX, type ThemeConfig, TimeBucket, type TimeBucketOptions, type TimeObject, type TimeObjectInput, TimeSpan, type TimeSpanUnit, type TimeString, type TimeValue, type TimestampMsInput, type TypeOf, type TypeOfMap, type ValuesOfObject, type WithCache, type WithCacheBucketBatchOptions, type WithCacheBucketOptions, type WithCacheFixedOptions, type WithCacheLruOptions, type WithCacheOptions, type WithCachePointer, type WithCacheResult, type WithCacheStorage, type WithCustomizer, type WithCustomizerFactory, type WithCustomizerValue, type WrrItem, alpha, arrayable, assert, asyncFilter, asyncFind, asyncForEach, asyncMap, avg, base64ToBytes, bigIntBytes, bigIntFromBytes, blendColors, buildCssColor, bytesToBase64, cache, cacheBucket, cacheFixed, cacheLRU, camelCase, capitalize, captureStackTrace, catchError, channelsToHSL, channelsToHex, channelsToRGB, checkBitmask, chunk, chunkSeries, clamp, cleanEmpty, cleanObject, colorToChannels, compareBytes, concatenateBytes, contrastRatio, convertToUnit, crc32, createCustomizer, createCustomizerFactory, createDateObject, createDeepCloneWith, createEJSON, createEJSONStream, createEnvParser, createRandomizer, createSecureCustomizer, createTimeObject, createTimeSpan, createWithCache, cssVariable, dateInDays, dateInSeconds, deepAssign, deepClone, deepCloneWith, deepDefaults, deepFreeze, def, defer, delay, difference, dropCache, env, escapeHtml, escapeNumeric, escapeRegExp, fastIdle, fastIdlePromise, fastRaf, findMean, flagsToMap, flatten, formatMoney, formatNumber, get, getFileExtension, getFileName, getInitials, getMostSpecificPaths, getRandomInt, getRandomTime, getWords, groupBy, has, hasOwn, hasProtocol, hex, hexToChannels, hmToSeconds, hslToChannels, humanFileSize, humanize, interpolateColor, intersection, isBigInt, isBoolean, isCached, isClient, isColorChannels, isCustomizerFactory, isDate, isDateObject, isDef, isEmpty, isEqual, isError, isFunction, isInfinity, isMap, isNullOrUndefined, isNumber, isObject, isOneEmoji, isPlainObject, isPrimitive, isPromise, isSet, isSkip, isString, isSuccess, isSymbol, isTimeObject, isTimeString, isTimeValue, isValidWeekDay, isWeakMap, isWeakSet, isWithCache, isoToFlagEmoji, kebabCase, keyBy, logger, lowerCase, luminance, maskingEmail, maskingPhone, maskingWords, nextTickIteration, noop, objectId, omit, omitPrefixed, orderBy, parseAllNumbers, parseAlpha, parsePercentage, percentOf, pick, pickPrefixed, qs, rafPromise, randomString, removeVS16s, retryOnError, rgbToChannels, round2digits, secondsToHm, set, shuffle, snakeCase, sprintf, startCase, strAssign, sum, timeFromMinutes, timeStringify, timeToMinutes, timeout, timestamp, timestampMs, timestampToDate, tintedTextColor, toError, toMap, truncate, typeOf, uint16ToUint8, uint32ToUint8, uint8ToUint16, uint8ToUint32, unflatten, union, uniq, uniqBy, unset, weeksInYear, weightedRoundRobin, withCache, withCacheBucket, withCacheBucketBatch, withCacheFixed, withCacheLRU, withDeepClone, withPointerCache, wrapText };