moderndash 3.10.0 → 3.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -19
- package/dist/index.d.ts +23 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -128,6 +128,7 @@ declare function dropWhile<TElem>(array: readonly TElem[], predicate: (value: TE
|
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Creates an object with grouped items in the array.
|
|
131
|
+
* @deprecated Use the javascript "Object.groupBy()" version instead.
|
|
131
132
|
*
|
|
132
133
|
* @example
|
|
133
134
|
* group([6.1, 4.2, 6.3], Math.floor)
|
|
@@ -827,19 +828,7 @@ declare function round(number: number, precision?: number): number;
|
|
|
827
828
|
declare function sum(numbers: number[]): number;
|
|
828
829
|
declare function sum<TNum extends readonly number[]>(numbers: TNum): Call<Tuples.Sum, TNum>;
|
|
829
830
|
|
|
830
|
-
|
|
831
|
-
* The type of a plain object.
|
|
832
|
-
*
|
|
833
|
-
* This is a more strict type than the `object` type which also includes functions and arrays.
|
|
834
|
-
*
|
|
835
|
-
* You can validate if a value is a plain object with {@link isPlainObject}.
|
|
836
|
-
* @example
|
|
837
|
-
* let obj: PlainObject = { a: 1, b: 2 };
|
|
838
|
-
*
|
|
839
|
-
* obj = [1, 2, 3];
|
|
840
|
-
* // => Type 'number[]' is not assignable to type 'PlainObject'.
|
|
841
|
-
*/
|
|
842
|
-
type PlainObject = Record<PropertyKey, unknown>;
|
|
831
|
+
type GenericObject = Record<PropertyKey, any>;
|
|
843
832
|
|
|
844
833
|
type StringIfNever<Type> = [Type] extends [never] ? string : Type;
|
|
845
834
|
type Paths$1<TObj> = StringIfNever<Call<Objects.AllPaths, TObj>>;
|
|
@@ -855,7 +844,21 @@ type Paths$1<TObj> = StringIfNever<Call<Objects.AllPaths, TObj>>;
|
|
|
855
844
|
* @template TObj The type of the object to flatten.
|
|
856
845
|
* @returns A new object with flattened keys.
|
|
857
846
|
*/
|
|
858
|
-
declare function flatKeys<TObj extends
|
|
847
|
+
declare function flatKeys<TObj extends GenericObject>(obj: TObj): Record<Paths$1<TObj>, unknown>;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* The type of a plain object.
|
|
851
|
+
*
|
|
852
|
+
* This is a more strict type than the `object` type which also includes functions and arrays.
|
|
853
|
+
*
|
|
854
|
+
* You can validate if a value is a plain object with {@link isPlainObject}.
|
|
855
|
+
* @example
|
|
856
|
+
* let obj: PlainObject = { a: 1, b: 2 };
|
|
857
|
+
*
|
|
858
|
+
* obj = [1, 2, 3];
|
|
859
|
+
* // => Type 'number[]' is not assignable to type 'PlainObject'.
|
|
860
|
+
*/
|
|
861
|
+
type PlainObject = Record<PropertyKey, unknown>;
|
|
859
862
|
|
|
860
863
|
/**
|
|
861
864
|
* This function combines two or more objects into a single new object. Arrays and other types are overwritten.
|
|
@@ -877,7 +880,7 @@ declare function flatKeys<TObj extends PlainObject>(obj: TObj): Record<Paths$1<T
|
|
|
877
880
|
* @template TSources The type of the source objects
|
|
878
881
|
* @returns A new merged object
|
|
879
882
|
*/
|
|
880
|
-
declare function merge<TTarget extends
|
|
883
|
+
declare function merge<TTarget extends GenericObject, TSources extends ArrayMinLength<GenericObject, 1>>(target: TTarget, ...sources: TSources): MergeDeepObjects<[TTarget, ...TSources]>;
|
|
881
884
|
type OptionalPropertyNames<T> = {
|
|
882
885
|
[K in keyof T]-?: (PlainObject extends {
|
|
883
886
|
[P in K]: T[K];
|
|
@@ -905,7 +908,7 @@ type MergeDeepObjects<A extends readonly [...unknown[]]> = A extends [infer L, .
|
|
|
905
908
|
* @template TObj The type of the object
|
|
906
909
|
* @returns - An object without the specified keys
|
|
907
910
|
*/
|
|
908
|
-
declare function omit<TObj extends
|
|
911
|
+
declare function omit<TObj extends GenericObject, Key extends keyof TObj>(object: TObj, keysToOmit: Key[]): Omit<TObj, Key>;
|
|
909
912
|
|
|
910
913
|
/**
|
|
911
914
|
* Creates an object composed of the picked `object` properties.
|
|
@@ -920,7 +923,7 @@ declare function omit<TObj extends PlainObject, Key extends keyof TObj>(object:
|
|
|
920
923
|
* @template TObj The type of the object.
|
|
921
924
|
* @returns Returns the new object.
|
|
922
925
|
*/
|
|
923
|
-
declare function pick<TObj extends
|
|
926
|
+
declare function pick<TObj extends GenericObject, Key extends keyof TObj>(object: TObj, keysToPick: Key[]): Pick<TObj, Key>;
|
|
924
927
|
|
|
925
928
|
type Paths<TObj> = Call<Objects.AllPaths, TObj> | string & {};
|
|
926
929
|
type UpdateObj<TObj extends PlainObject, TPath extends string, TVal> = Call<Objects.Update<TPath, TVal>, TObj>;
|
|
@@ -952,7 +955,7 @@ type UpdateObj<TObj extends PlainObject, TPath extends string, TVal> = Call<Obje
|
|
|
952
955
|
* @template TVal The type of the value to set.
|
|
953
956
|
* @returns The modified object.
|
|
954
957
|
*/
|
|
955
|
-
declare function set<TObj extends
|
|
958
|
+
declare function set<TObj extends GenericObject, TPath extends Paths<TObj>, TVal>(obj: TObj, path: TPath, value: TVal): UpdateObj<TObj, TPath, TVal>;
|
|
956
959
|
|
|
957
960
|
/**
|
|
958
961
|
* A class managing an async function queue with limited concurrency (e.g., 10 functions with 3 running at a time).
|
|
@@ -1445,6 +1448,7 @@ declare function isPlainObject(value: unknown): value is PlainObject;
|
|
|
1445
1448
|
|
|
1446
1449
|
/**
|
|
1447
1450
|
* Checks if given string is a valid URL
|
|
1451
|
+
* @deprecated Use the native "URL.canParse" method instead.
|
|
1448
1452
|
*
|
|
1449
1453
|
* @example
|
|
1450
1454
|
* isUrl('https://google.com')
|
|
@@ -1456,4 +1460,4 @@ declare function isPlainObject(value: unknown): value is PlainObject;
|
|
|
1456
1460
|
*/
|
|
1457
1461
|
declare function isUrl(str: string): boolean;
|
|
1458
1462
|
|
|
1459
|
-
export { type ArrayMinLength, type GenericFunction, type Jsonifiable, type PlainObject, Queue, average, camelCase, capitalize, chunk, count, debounce, deburr, decDebounce, decMaxCalls, decMemoize, decMinCalls, decThrottle, difference, dropRightWhile, dropWhile, escapeHtml, escapeRegExp, flatKeys, group, hash, intersection, isEmpty, isEqual, isPlainObject, isUrl, kebabCase, maxCalls, median, memoize, merge, minCalls, move, omit, pascalCase, pick, races, randomElem, randomFloat, randomInt, randomString, range, replaceLast, retry, round, set, shuffle, sleep, snakeCase, sort, splitWords, sum, takeRightWhile, takeWhile, throttle, timeout, times, titleCase, toDecorator, trim, trimEnd, trimStart, truncate, tryCatch, unescapeHtml, unique };
|
|
1463
|
+
export { type ArrayMinLength, type GenericFunction, type GenericObject, type Jsonifiable, type PlainObject, Queue, average, camelCase, capitalize, chunk, count, debounce, deburr, decDebounce, decMaxCalls, decMemoize, decMinCalls, decThrottle, difference, dropRightWhile, dropWhile, escapeHtml, escapeRegExp, flatKeys, group, hash, intersection, isEmpty, isEqual, isPlainObject, isUrl, kebabCase, maxCalls, median, memoize, merge, minCalls, move, omit, pascalCase, pick, races, randomElem, randomFloat, randomInt, randomString, range, replaceLast, retry, round, set, shuffle, sleep, snakeCase, sort, splitWords, sum, takeRightWhile, takeWhile, throttle, timeout, times, titleCase, toDecorator, trim, trimEnd, trimStart, truncate, tryCatch, unescapeHtml, unique };
|
package/dist/index.d.ts
CHANGED
|
@@ -128,6 +128,7 @@ declare function dropWhile<TElem>(array: readonly TElem[], predicate: (value: TE
|
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Creates an object with grouped items in the array.
|
|
131
|
+
* @deprecated Use the javascript "Object.groupBy()" version instead.
|
|
131
132
|
*
|
|
132
133
|
* @example
|
|
133
134
|
* group([6.1, 4.2, 6.3], Math.floor)
|
|
@@ -827,19 +828,7 @@ declare function round(number: number, precision?: number): number;
|
|
|
827
828
|
declare function sum(numbers: number[]): number;
|
|
828
829
|
declare function sum<TNum extends readonly number[]>(numbers: TNum): Call<Tuples.Sum, TNum>;
|
|
829
830
|
|
|
830
|
-
|
|
831
|
-
* The type of a plain object.
|
|
832
|
-
*
|
|
833
|
-
* This is a more strict type than the `object` type which also includes functions and arrays.
|
|
834
|
-
*
|
|
835
|
-
* You can validate if a value is a plain object with {@link isPlainObject}.
|
|
836
|
-
* @example
|
|
837
|
-
* let obj: PlainObject = { a: 1, b: 2 };
|
|
838
|
-
*
|
|
839
|
-
* obj = [1, 2, 3];
|
|
840
|
-
* // => Type 'number[]' is not assignable to type 'PlainObject'.
|
|
841
|
-
*/
|
|
842
|
-
type PlainObject = Record<PropertyKey, unknown>;
|
|
831
|
+
type GenericObject = Record<PropertyKey, any>;
|
|
843
832
|
|
|
844
833
|
type StringIfNever<Type> = [Type] extends [never] ? string : Type;
|
|
845
834
|
type Paths$1<TObj> = StringIfNever<Call<Objects.AllPaths, TObj>>;
|
|
@@ -855,7 +844,21 @@ type Paths$1<TObj> = StringIfNever<Call<Objects.AllPaths, TObj>>;
|
|
|
855
844
|
* @template TObj The type of the object to flatten.
|
|
856
845
|
* @returns A new object with flattened keys.
|
|
857
846
|
*/
|
|
858
|
-
declare function flatKeys<TObj extends
|
|
847
|
+
declare function flatKeys<TObj extends GenericObject>(obj: TObj): Record<Paths$1<TObj>, unknown>;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* The type of a plain object.
|
|
851
|
+
*
|
|
852
|
+
* This is a more strict type than the `object` type which also includes functions and arrays.
|
|
853
|
+
*
|
|
854
|
+
* You can validate if a value is a plain object with {@link isPlainObject}.
|
|
855
|
+
* @example
|
|
856
|
+
* let obj: PlainObject = { a: 1, b: 2 };
|
|
857
|
+
*
|
|
858
|
+
* obj = [1, 2, 3];
|
|
859
|
+
* // => Type 'number[]' is not assignable to type 'PlainObject'.
|
|
860
|
+
*/
|
|
861
|
+
type PlainObject = Record<PropertyKey, unknown>;
|
|
859
862
|
|
|
860
863
|
/**
|
|
861
864
|
* This function combines two or more objects into a single new object. Arrays and other types are overwritten.
|
|
@@ -877,7 +880,7 @@ declare function flatKeys<TObj extends PlainObject>(obj: TObj): Record<Paths$1<T
|
|
|
877
880
|
* @template TSources The type of the source objects
|
|
878
881
|
* @returns A new merged object
|
|
879
882
|
*/
|
|
880
|
-
declare function merge<TTarget extends
|
|
883
|
+
declare function merge<TTarget extends GenericObject, TSources extends ArrayMinLength<GenericObject, 1>>(target: TTarget, ...sources: TSources): MergeDeepObjects<[TTarget, ...TSources]>;
|
|
881
884
|
type OptionalPropertyNames<T> = {
|
|
882
885
|
[K in keyof T]-?: (PlainObject extends {
|
|
883
886
|
[P in K]: T[K];
|
|
@@ -905,7 +908,7 @@ type MergeDeepObjects<A extends readonly [...unknown[]]> = A extends [infer L, .
|
|
|
905
908
|
* @template TObj The type of the object
|
|
906
909
|
* @returns - An object without the specified keys
|
|
907
910
|
*/
|
|
908
|
-
declare function omit<TObj extends
|
|
911
|
+
declare function omit<TObj extends GenericObject, Key extends keyof TObj>(object: TObj, keysToOmit: Key[]): Omit<TObj, Key>;
|
|
909
912
|
|
|
910
913
|
/**
|
|
911
914
|
* Creates an object composed of the picked `object` properties.
|
|
@@ -920,7 +923,7 @@ declare function omit<TObj extends PlainObject, Key extends keyof TObj>(object:
|
|
|
920
923
|
* @template TObj The type of the object.
|
|
921
924
|
* @returns Returns the new object.
|
|
922
925
|
*/
|
|
923
|
-
declare function pick<TObj extends
|
|
926
|
+
declare function pick<TObj extends GenericObject, Key extends keyof TObj>(object: TObj, keysToPick: Key[]): Pick<TObj, Key>;
|
|
924
927
|
|
|
925
928
|
type Paths<TObj> = Call<Objects.AllPaths, TObj> | string & {};
|
|
926
929
|
type UpdateObj<TObj extends PlainObject, TPath extends string, TVal> = Call<Objects.Update<TPath, TVal>, TObj>;
|
|
@@ -952,7 +955,7 @@ type UpdateObj<TObj extends PlainObject, TPath extends string, TVal> = Call<Obje
|
|
|
952
955
|
* @template TVal The type of the value to set.
|
|
953
956
|
* @returns The modified object.
|
|
954
957
|
*/
|
|
955
|
-
declare function set<TObj extends
|
|
958
|
+
declare function set<TObj extends GenericObject, TPath extends Paths<TObj>, TVal>(obj: TObj, path: TPath, value: TVal): UpdateObj<TObj, TPath, TVal>;
|
|
956
959
|
|
|
957
960
|
/**
|
|
958
961
|
* A class managing an async function queue with limited concurrency (e.g., 10 functions with 3 running at a time).
|
|
@@ -1445,6 +1448,7 @@ declare function isPlainObject(value: unknown): value is PlainObject;
|
|
|
1445
1448
|
|
|
1446
1449
|
/**
|
|
1447
1450
|
* Checks if given string is a valid URL
|
|
1451
|
+
* @deprecated Use the native "URL.canParse" method instead.
|
|
1448
1452
|
*
|
|
1449
1453
|
* @example
|
|
1450
1454
|
* isUrl('https://google.com')
|
|
@@ -1456,4 +1460,4 @@ declare function isPlainObject(value: unknown): value is PlainObject;
|
|
|
1456
1460
|
*/
|
|
1457
1461
|
declare function isUrl(str: string): boolean;
|
|
1458
1462
|
|
|
1459
|
-
export { type ArrayMinLength, type GenericFunction, type Jsonifiable, type PlainObject, Queue, average, camelCase, capitalize, chunk, count, debounce, deburr, decDebounce, decMaxCalls, decMemoize, decMinCalls, decThrottle, difference, dropRightWhile, dropWhile, escapeHtml, escapeRegExp, flatKeys, group, hash, intersection, isEmpty, isEqual, isPlainObject, isUrl, kebabCase, maxCalls, median, memoize, merge, minCalls, move, omit, pascalCase, pick, races, randomElem, randomFloat, randomInt, randomString, range, replaceLast, retry, round, set, shuffle, sleep, snakeCase, sort, splitWords, sum, takeRightWhile, takeWhile, throttle, timeout, times, titleCase, toDecorator, trim, trimEnd, trimStart, truncate, tryCatch, unescapeHtml, unique };
|
|
1463
|
+
export { type ArrayMinLength, type GenericFunction, type GenericObject, type Jsonifiable, type PlainObject, Queue, average, camelCase, capitalize, chunk, count, debounce, deburr, decDebounce, decMaxCalls, decMemoize, decMinCalls, decThrottle, difference, dropRightWhile, dropWhile, escapeHtml, escapeRegExp, flatKeys, group, hash, intersection, isEmpty, isEqual, isPlainObject, isUrl, kebabCase, maxCalls, median, memoize, merge, minCalls, move, omit, pascalCase, pick, races, randomElem, randomFloat, randomInt, randomString, range, replaceLast, retry, round, set, shuffle, sleep, snakeCase, sort, splitWords, sum, takeRightWhile, takeWhile, throttle, timeout, times, titleCase, toDecorator, trim, trimEnd, trimStart, truncate, tryCatch, unescapeHtml, unique };
|