moderndash 1.1.1 → 1.2.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/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +72 -58
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ declare function group<TElem, TKey extends PropertyKey>(array: TElem[], criteria
|
|
|
153
153
|
*
|
|
154
154
|
* intersection((a, b) => a.id === b.id, arr1, arr2)
|
|
155
155
|
* // => [{ id: 3, name: 'John' }]
|
|
156
|
-
* @param arrays
|
|
156
|
+
* @param arrays The arrays to inspect.
|
|
157
157
|
* @returns Returns the new array of intersecting values.
|
|
158
158
|
*/
|
|
159
159
|
declare function intersection<TArr>(...arrays: ArrayMinLength<TArr[], 2>): TArr[];
|
|
@@ -193,7 +193,7 @@ declare function range(start: number, end: number, step?: number): Generator<num
|
|
|
193
193
|
*
|
|
194
194
|
* sample([1, 2, 3, 4], 2)
|
|
195
195
|
* // => [3, 1]
|
|
196
|
-
* @param array
|
|
196
|
+
* @param array The array to sample.
|
|
197
197
|
* @returns Returns the random element.
|
|
198
198
|
*/
|
|
199
199
|
declare function sample<TArr>(array: TArr[]): TArr | undefined;
|
|
@@ -206,7 +206,7 @@ declare function sample<TArr>(array: TArr[], multi: number): TArr[];
|
|
|
206
206
|
* @example
|
|
207
207
|
* shuffle([1, 2, 3, 4])
|
|
208
208
|
* // => [4, 1, 3, 2]
|
|
209
|
-
* @param array
|
|
209
|
+
* @param array The array or object to shuffle.
|
|
210
210
|
* @returns Returns the new shuffled array.
|
|
211
211
|
*/
|
|
212
212
|
declare function shuffle<TArr>(array: TArr[]): TArr[];
|
|
@@ -226,8 +226,8 @@ declare function shuffle<TArr>(array: TArr[]): TArr[];
|
|
|
226
226
|
* { order: 'desc', by: item => item.b }
|
|
227
227
|
* )
|
|
228
228
|
* // => [{ a: 1, b: 2 }, { a: 1, b: 1 }, { a: 2, b: 1 }]
|
|
229
|
-
* @param array
|
|
230
|
-
* @param orders
|
|
229
|
+
* @param array The array to sort.
|
|
230
|
+
* @param orders The sorting criteria, one or multiple objects with properties order (either 'asc' or 'desc') and by (iteratee function to sort based on a specific property).
|
|
231
231
|
* @param orders.order - The order to sort in, either 'asc' or 'desc'.
|
|
232
232
|
* @param orders.by - The iteratee function to sort based on a specific property.
|
|
233
233
|
* @returns Returns the sorted array.
|
|
@@ -250,8 +250,8 @@ declare function sort<TInput>(array: TInput[], ...orders: {
|
|
|
250
250
|
*
|
|
251
251
|
* takeRightWhile(({ active }) => active, users)
|
|
252
252
|
* // => objects for ['fred', 'pebbles']
|
|
253
|
-
* @param predicate
|
|
254
|
-
* @param array
|
|
253
|
+
* @param predicate The function invoked per iteration.
|
|
254
|
+
* @param array The array to query.
|
|
255
255
|
* @returns Returns the slice of `array`.
|
|
256
256
|
*/
|
|
257
257
|
declare function takeRightWhile<TArr>(predicate: (elem: TArr) => boolean, array: TArr[]): TArr[];
|
|
@@ -294,8 +294,8 @@ declare function takeWhile<TArr>(array: TArr[], predicate: (elem: TArr) => boole
|
|
|
294
294
|
* // => [{ id: 1, name: 'a' }]
|
|
295
295
|
*
|
|
296
296
|
*
|
|
297
|
-
* @param array
|
|
298
|
-
* @param iteratee
|
|
297
|
+
* @param array The array to inspect.
|
|
298
|
+
* @param iteratee The iteratee invoked per element.
|
|
299
299
|
* @returns Returns the new duplicate free array.
|
|
300
300
|
*/
|
|
301
301
|
declare function unique<TInput>(array: TInput[], compareFn?: (a: TInput, b: TInput) => boolean): TInput[];
|
|
@@ -321,7 +321,7 @@ declare function unique<TInput>(array: TInput[], compareFn?: (a: TInput, b: TInp
|
|
|
321
321
|
* instance.testMethod("World");
|
|
322
322
|
* // => Only the second invocation of `debouncedSayHello` is executed, after a delay of 1000ms.
|
|
323
323
|
* ```
|
|
324
|
-
* @param wait
|
|
324
|
+
* @param wait Milliseconds to wait before invoking the decorated function after the last invocation.
|
|
325
325
|
*/
|
|
326
326
|
declare function decDebounce(wait: number): (target: unknown, key: string, descriptor: PropertyDescriptor) => void;
|
|
327
327
|
|
|
@@ -347,7 +347,7 @@ declare function decDebounce(wait: number): (target: unknown, key: string, descr
|
|
|
347
347
|
* instance.testMethod(); // => 2
|
|
348
348
|
* instance.testMethod(); // => 2
|
|
349
349
|
* ```
|
|
350
|
-
* @param n
|
|
350
|
+
* @param n The number of calls before the cached result is returned.
|
|
351
351
|
*/
|
|
352
352
|
declare function decMaxCalls(n: number): (target: unknown, key: string, descriptor: PropertyDescriptor) => void;
|
|
353
353
|
|
|
@@ -388,8 +388,8 @@ type GenericFunction<TFunc extends (...args: any) => any> = (...args: Parameters
|
|
|
388
388
|
* // This is the default way to create cache keys.
|
|
389
389
|
* const defaultResolver = (...args: unknown[]) => JSON.stringify(args)
|
|
390
390
|
* ```
|
|
391
|
-
* @param func
|
|
392
|
-
* @param options
|
|
391
|
+
* @param func The function to have its output memoized.
|
|
392
|
+
* @param options The options object with optional `resolver` and `ttl` parameters.
|
|
393
393
|
* @param options.resolver - A function that determines the cache key for storing the result based on the arguments provided.
|
|
394
394
|
* @param options.ttl - The time to live for the cache in milliseconds.
|
|
395
395
|
* @template TFunc The type of the function to memoize.
|
|
@@ -430,7 +430,7 @@ declare function memoize<TFunc extends GenericFunction<TFunc>, Cache extends Map
|
|
|
430
430
|
* // After 1 second:
|
|
431
431
|
* instance.testMethod(1, 2); // => 3 (cache miss)
|
|
432
432
|
* ```
|
|
433
|
-
* @param options
|
|
433
|
+
* @param options The options object.
|
|
434
434
|
* @param options.resolver - A function that determines the cache key for storing the result based on the arguments provided.
|
|
435
435
|
* @param options.ttl - The time to live for the cache in milliseconds.
|
|
436
436
|
*/
|
|
@@ -479,7 +479,7 @@ declare function decMinCalls(n: number): (target: unknown, key: string, descript
|
|
|
479
479
|
* instance.testMethod(); // => "Throttled!" is logged once per second.
|
|
480
480
|
* instance.testMethod(); // nothing happens
|
|
481
481
|
* ```
|
|
482
|
-
* @param wait
|
|
482
|
+
* @param wait The number of milliseconds to wait between invocations.
|
|
483
483
|
*/
|
|
484
484
|
declare function decThrottle(wait: number): (target: unknown, key: string, descriptor: PropertyDescriptor) => void;
|
|
485
485
|
|
|
@@ -509,7 +509,7 @@ type Tail<T extends unknown[]> = T extends [infer _Head, ...infer Tail] ? Tail :
|
|
|
509
509
|
* instance.testMethod();
|
|
510
510
|
* // => Log "Hello World" and return 1
|
|
511
511
|
* ```
|
|
512
|
-
* @param func
|
|
512
|
+
* @param func The function to transform.
|
|
513
513
|
* @returns A decorator function that can be used to decorate a method.
|
|
514
514
|
*/
|
|
515
515
|
declare function toDecorator<TFunc extends GenericFunction<TFunc>>(func: TFunc): (...args: Tail<Parameters<TFunc>>) => (target: unknown, key: string, descriptor: PropertyDescriptor) => void;
|
|
@@ -530,8 +530,8 @@ declare function toDecorator<TFunc extends GenericFunction<TFunc>>(func: TFunc):
|
|
|
530
530
|
* debouncedSayHello("John");
|
|
531
531
|
* debouncedSayHello("Jane");
|
|
532
532
|
* // => Only the second invocation of `debouncedSayHello` is executed, after a delay of 200ms.
|
|
533
|
-
* @param func
|
|
534
|
-
* @param wait
|
|
533
|
+
* @param func The function to debounce.
|
|
534
|
+
* @param wait The number of milliseconds to wait before invoking `func`.
|
|
535
535
|
* @returns A debounced version of `func` with `cancel` and `flush` methods.
|
|
536
536
|
*/
|
|
537
537
|
declare function debounce<TFunc extends GenericFunction<TFunc>>(func: TFunc, wait: number): TFunc & {
|
|
@@ -556,8 +556,8 @@ declare function debounce<TFunc extends GenericFunction<TFunc>>(func: TFunc, wai
|
|
|
556
556
|
* limitAddCount() // => 2
|
|
557
557
|
* limitAddCount() // => 2
|
|
558
558
|
* // => `limitAddCount` is invoked twice and the result is cached.
|
|
559
|
-
* @param n
|
|
560
|
-
* @param func
|
|
559
|
+
* @param n The number of calls before the cached result is returned.
|
|
560
|
+
* @param func The function to restrict.
|
|
561
561
|
* @returns Returns the new restricted function.
|
|
562
562
|
*/
|
|
563
563
|
declare function maxCalls<TFunc extends GenericFunction<TFunc>>(func: TFunc, n: number): TFunc;
|
|
@@ -591,8 +591,8 @@ declare function minCalls<TFunc extends GenericFunction<TFunc>>(func: TFunc, n:
|
|
|
591
591
|
* throttled();
|
|
592
592
|
* throttled();
|
|
593
593
|
* // => "Throttled!" is logged once per second.
|
|
594
|
-
* @param func
|
|
595
|
-
* @param wait
|
|
594
|
+
* @param func The function to throttle.
|
|
595
|
+
* @param wait The number of milliseconds to throttle invocations to.
|
|
596
596
|
* @returns Returns the new throttled function.
|
|
597
597
|
*/
|
|
598
598
|
declare function throttle<TFunc extends GenericFunction<TFunc>>(func: TFunc, wait: number): TFunc;
|
|
@@ -608,8 +608,8 @@ declare function throttle<TFunc extends GenericFunction<TFunc>>(func: TFunc, wai
|
|
|
608
608
|
* // => [0.123, 0.456, 0.789]
|
|
609
609
|
* times(() => 0, 4)
|
|
610
610
|
* // => [0, 0, 0, 0]
|
|
611
|
-
* @param n
|
|
612
|
-
* @param func
|
|
611
|
+
* @param n The number of times to invoke `func`.
|
|
612
|
+
* @param func The function invoked per iteration.
|
|
613
613
|
* @returns Returns an array of results.
|
|
614
614
|
*/
|
|
615
615
|
declare function times<TInput>(func: (index: number) => TInput, n: number): TInput[];
|
|
@@ -621,7 +621,7 @@ declare function times<TInput>(func: (index: number) => TInput, n: number): TInp
|
|
|
621
621
|
* @example
|
|
622
622
|
* average([1, 2, 3, 4, 5]) // => 3
|
|
623
623
|
*
|
|
624
|
-
* @param numbers
|
|
624
|
+
* @param numbers The input array of numbers
|
|
625
625
|
* @returns The average of the input array, or NaN if the input array is empty
|
|
626
626
|
*/
|
|
627
627
|
declare function average(numbers: number[]): number;
|
|
@@ -634,7 +634,7 @@ declare function average(numbers: number[]): number;
|
|
|
634
634
|
* median([1, 2, 3, 4, 5]) // => 3
|
|
635
635
|
* median([1, 2, 3, 4, 5, 6]) // => 3.5
|
|
636
636
|
*
|
|
637
|
-
* @param numbers
|
|
637
|
+
* @param numbers The input array of numbers
|
|
638
638
|
* @returns The median of the input array
|
|
639
639
|
*/
|
|
640
640
|
declare function median(numbers: number[]): number;
|
|
@@ -646,8 +646,8 @@ declare function median(numbers: number[]): number;
|
|
|
646
646
|
* @example
|
|
647
647
|
* randomFloat(1, 10) // => 1.123456789
|
|
648
648
|
*
|
|
649
|
-
* @param min
|
|
650
|
-
* @param max
|
|
649
|
+
* @param min The smallest float that can be generated.
|
|
650
|
+
* @param max The largest float that can be generated.
|
|
651
651
|
*
|
|
652
652
|
* @returns A random float between `min` and `max`, including `min` and `max`.
|
|
653
653
|
*/
|
|
@@ -660,13 +660,27 @@ declare function randomFloat(min: number, max: number): number;
|
|
|
660
660
|
* @example
|
|
661
661
|
* randomInt(1, 10) // => 5
|
|
662
662
|
*
|
|
663
|
-
* @param min
|
|
664
|
-
* @param max
|
|
663
|
+
* @param min The smallest integer that can be generated.
|
|
664
|
+
* @param max The largest integer that can be generated.
|
|
665
665
|
*
|
|
666
666
|
* @returns A random integer between `min` and `max`, including `min` and `max`.
|
|
667
667
|
*/
|
|
668
668
|
declare function randomInt(min: number, max: number): number;
|
|
669
669
|
|
|
670
|
+
/**
|
|
671
|
+
* Rounds a number to the given precision.
|
|
672
|
+
*
|
|
673
|
+
* @example
|
|
674
|
+
* round(1.23456, 2); // => 1.23
|
|
675
|
+
* round(1.235, 1); // => 1.2
|
|
676
|
+
* round(1234.56); // => 1234.56
|
|
677
|
+
*
|
|
678
|
+
* @param number The number to be rounded.
|
|
679
|
+
* @param precision The number of decimal places to round to. Defaults to 2.
|
|
680
|
+
* @returns The rounded number.
|
|
681
|
+
*/
|
|
682
|
+
declare function round(number: number, precision?: number): number;
|
|
683
|
+
|
|
670
684
|
/**
|
|
671
685
|
* Calculates the sum of an array of numbers.
|
|
672
686
|
*
|
|
@@ -674,7 +688,7 @@ declare function randomInt(min: number, max: number): number;
|
|
|
674
688
|
* @example
|
|
675
689
|
* sum([1, 2, 3, 4, 5]) // => 15
|
|
676
690
|
*
|
|
677
|
-
* @param numbers
|
|
691
|
+
* @param numbers The input array of numbers
|
|
678
692
|
* @returns The sum of the input array
|
|
679
693
|
*/
|
|
680
694
|
declare function sum(numbers: number[]): number;
|
|
@@ -707,8 +721,8 @@ type PlainObject = Record<PropertyKey, unknown>;
|
|
|
707
721
|
*
|
|
708
722
|
* merge({ a: 1 }, { a: "Yes" })
|
|
709
723
|
* // => { a: "Yes" }
|
|
710
|
-
* @param target
|
|
711
|
-
* @param sources
|
|
724
|
+
* @param target The target object
|
|
725
|
+
* @param sources The source objects
|
|
712
726
|
* @returns A new merged object
|
|
713
727
|
*/
|
|
714
728
|
declare function merge<TTarget extends PlainObject, TSources extends ArrayMinLength<PlainObject, 1>>(target: TTarget, ...sources: TSources): MergeDeepObjects<[TTarget, ...TSources]>;
|
|
@@ -734,8 +748,8 @@ type MergeDeepObjects<A extends readonly [...unknown[]]> = A extends [infer L, .
|
|
|
734
748
|
* omit(obj, ['a', 'b']);
|
|
735
749
|
* // => {c: 3}
|
|
736
750
|
*
|
|
737
|
-
* @param object
|
|
738
|
-
* @param keysToOmit
|
|
751
|
+
* @param object The object to filter
|
|
752
|
+
* @param keysToOmit The keys to exclude from the returned object
|
|
739
753
|
* @returns - An object without the specified keys
|
|
740
754
|
*
|
|
741
755
|
*/
|
|
@@ -749,8 +763,8 @@ declare function omit<TObj extends PlainObject, Key extends keyof TObj>(object:
|
|
|
749
763
|
*
|
|
750
764
|
* pick(object, ['a', 'c'])
|
|
751
765
|
* // => { 'a': 1, 'c': 3 }
|
|
752
|
-
* @param object
|
|
753
|
-
* @param keysToPick
|
|
766
|
+
* @param object The source object.
|
|
767
|
+
* @param keysToPick The property paths to pick.
|
|
754
768
|
* @returns Returns the new object.
|
|
755
769
|
*/
|
|
756
770
|
declare function pick<TInput extends PlainObject, Key extends keyof TInput>(object: TInput, keysToPick: Key[]): Pick<TInput, Key>;
|
|
@@ -809,13 +823,13 @@ declare class Queue {
|
|
|
809
823
|
private queue;
|
|
810
824
|
/**
|
|
811
825
|
* @constructor
|
|
812
|
-
* @param maxConcurrent
|
|
826
|
+
* @param maxConcurrent The maximum number of async functions to run concurrently.
|
|
813
827
|
*/
|
|
814
828
|
constructor(maxConcurrent: number);
|
|
815
829
|
/**
|
|
816
830
|
* Add aync functions or an array of async functions to the queue.
|
|
817
831
|
*
|
|
818
|
-
* @param asyncFn
|
|
832
|
+
* @param asyncFn The aync function(s) to add to the queue.
|
|
819
833
|
* @returns A promise that resolves when the added function(s) finishes.
|
|
820
834
|
*/
|
|
821
835
|
add<TProm, TAsyncFn extends () => Promise<TProm>>(asyncFn: TAsyncFn): Promise<TProm>;
|
|
@@ -895,7 +909,7 @@ declare function retry<TRes>(func: () => Promise<TRes>, options?: {
|
|
|
895
909
|
* @example
|
|
896
910
|
* await sleep(1000);
|
|
897
911
|
* // => Waits for 1 second.
|
|
898
|
-
* @param ms
|
|
912
|
+
* @param ms Amount of time to sleep in milliseconds.
|
|
899
913
|
* @returns A promise that resolves after the given amount of time.
|
|
900
914
|
*/
|
|
901
915
|
declare function sleep(ms: number): Promise<unknown>;
|
|
@@ -911,8 +925,8 @@ declare function sleep(ms: number): Promise<unknown>;
|
|
|
911
925
|
* // => 'Promise timed out after 1000ms'
|
|
912
926
|
* }
|
|
913
927
|
* @template TRes - The type of the resolved value.
|
|
914
|
-
* @param promise
|
|
915
|
-
* @param timeout
|
|
928
|
+
* @param promise The promise to wrap.
|
|
929
|
+
* @param timeout The timeout in milliseconds.
|
|
916
930
|
*
|
|
917
931
|
* @returns A new promise that will reject with an error after the specified timeout.
|
|
918
932
|
*/
|
|
@@ -928,7 +942,7 @@ declare function timeout<TRes>(promise: Promise<TRes>, timeout: number): Promise
|
|
|
928
942
|
* // => 'fooBar'
|
|
929
943
|
* camelCase('__FOO_BAR__')
|
|
930
944
|
* // => 'fooBar'
|
|
931
|
-
* @param str
|
|
945
|
+
* @param str The string to convert.
|
|
932
946
|
* @returns Returns the camel cased string.
|
|
933
947
|
*/
|
|
934
948
|
declare function camelCase(str: string): string;
|
|
@@ -939,7 +953,7 @@ declare function camelCase(str: string): string;
|
|
|
939
953
|
* @example
|
|
940
954
|
* capitalize('FRED')
|
|
941
955
|
* // => 'Fred'
|
|
942
|
-
* @param str
|
|
956
|
+
* @param str The string to capitalize.
|
|
943
957
|
* @returns Returns the capitalized string.
|
|
944
958
|
*/
|
|
945
959
|
declare function capitalize(str: string): string;
|
|
@@ -954,7 +968,7 @@ declare function capitalize(str: string): string;
|
|
|
954
968
|
* @example
|
|
955
969
|
* deburr('déjà vu')
|
|
956
970
|
* // => 'deja vu'
|
|
957
|
-
* @param str
|
|
971
|
+
* @param str The string to deburr.
|
|
958
972
|
* @returns Returns the deburred string.
|
|
959
973
|
*/
|
|
960
974
|
declare function deburr(str: string): string;
|
|
@@ -965,7 +979,7 @@ declare function deburr(str: string): string;
|
|
|
965
979
|
* @example
|
|
966
980
|
* escapeHtml('fred, barney, & pebbles')
|
|
967
981
|
* // => 'fred, barney, & pebbles'
|
|
968
|
-
* @param str
|
|
982
|
+
* @param str The string to escape.
|
|
969
983
|
* @returns Returns the escaped string.
|
|
970
984
|
*/
|
|
971
985
|
declare function escapeHtml(str: string): string;
|
|
@@ -977,7 +991,7 @@ declare function escapeHtml(str: string): string;
|
|
|
977
991
|
* @example
|
|
978
992
|
* escapeRegExp('[moderndash](https://moderndash.io/)')
|
|
979
993
|
* // => '\[moderndash\]\(https://moderndash\.io/\)'
|
|
980
|
-
* @param str
|
|
994
|
+
* @param str The string to escape.
|
|
981
995
|
* @returns Returns the escaped string.
|
|
982
996
|
*/
|
|
983
997
|
declare function escapeRegExp(str: string): string;
|
|
@@ -993,7 +1007,7 @@ declare function escapeRegExp(str: string): string;
|
|
|
993
1007
|
* kebabCase('__FOO_BAR__')
|
|
994
1008
|
* // => 'foo-bar'
|
|
995
1009
|
*
|
|
996
|
-
* @param str
|
|
1010
|
+
* @param str The string to convert.
|
|
997
1011
|
* @returns Returns the kebab cased string.
|
|
998
1012
|
*/
|
|
999
1013
|
declare function kebabCase(str: string): string;
|
|
@@ -1009,7 +1023,7 @@ declare function kebabCase(str: string): string;
|
|
|
1009
1023
|
* pascalCase('__FOO_BAR__')
|
|
1010
1024
|
* // => 'FooBar'
|
|
1011
1025
|
*
|
|
1012
|
-
* @param str
|
|
1026
|
+
* @param str The string to convert.
|
|
1013
1027
|
* @returns Returns the pascal cased string.
|
|
1014
1028
|
*/
|
|
1015
1029
|
declare function pascalCase(str: string): string;
|
|
@@ -1027,7 +1041,7 @@ declare function pascalCase(str: string): string;
|
|
|
1027
1041
|
* snakeCase('foo2bar')
|
|
1028
1042
|
* // => 'foo_2_bar'
|
|
1029
1043
|
*
|
|
1030
|
-
* @param str
|
|
1044
|
+
* @param str The string to convert.
|
|
1031
1045
|
* @returns Returns the snake cased string.
|
|
1032
1046
|
*/
|
|
1033
1047
|
declare function snakeCase(str: string): string;
|
|
@@ -1062,7 +1076,7 @@ declare function splitWords(str: string): string[];
|
|
|
1062
1076
|
* // => 'Foo Bar'
|
|
1063
1077
|
* titleCase('HélloWorld')
|
|
1064
1078
|
* // => 'Hello World'
|
|
1065
|
-
* @param str
|
|
1079
|
+
* @param str The string to convert.
|
|
1066
1080
|
* @returns Returns the title cased string.
|
|
1067
1081
|
*/
|
|
1068
1082
|
declare function titleCase(str: string): string;
|
|
@@ -1074,7 +1088,7 @@ declare function titleCase(str: string): string;
|
|
|
1074
1088
|
* @example
|
|
1075
1089
|
* unescapeHtml('fred, barney, & pebbles')
|
|
1076
1090
|
* // => 'fred, barney, & pebbles'
|
|
1077
|
-
* @param str
|
|
1091
|
+
* @param str The string to unescape.
|
|
1078
1092
|
* @returns Returns the unescaped string.
|
|
1079
1093
|
*/
|
|
1080
1094
|
declare function unescapeHtml(str: string): string;
|
|
@@ -1100,7 +1114,7 @@ declare function unescapeHtml(str: string): string;
|
|
|
1100
1114
|
*
|
|
1101
1115
|
* isEmpty({ 'a': 1 })
|
|
1102
1116
|
* // => false
|
|
1103
|
-
* @param value
|
|
1117
|
+
* @param value The value to check.
|
|
1104
1118
|
* @returns Returns `true` if given vlaue is empty, else `false`.
|
|
1105
1119
|
*/
|
|
1106
1120
|
declare function isEmpty(value: string | object | null | undefined): boolean;
|
|
@@ -1118,8 +1132,8 @@ declare function isEmpty(value: string | object | null | undefined): boolean;
|
|
|
1118
1132
|
*
|
|
1119
1133
|
* object === other;
|
|
1120
1134
|
* // => false
|
|
1121
|
-
* @param a
|
|
1122
|
-
* @param b
|
|
1135
|
+
* @param a The value to compare.
|
|
1136
|
+
* @param b The other value to compare.
|
|
1123
1137
|
* @returns Returns `true` if the values are equivalent, else `false`.
|
|
1124
1138
|
*/
|
|
1125
1139
|
declare function isEqual(a: unknown, b: unknown): boolean;
|
|
@@ -1135,7 +1149,7 @@ declare function isEqual(a: unknown, b: unknown): boolean;
|
|
|
1135
1149
|
* isPlainObject([]) // => false
|
|
1136
1150
|
* isPlainObject(new Function()) // => false
|
|
1137
1151
|
* isPlainObject(new Date()) // => false
|
|
1138
|
-
* @param value
|
|
1152
|
+
* @param value The value to check
|
|
1139
1153
|
* @returns Boolean indicating if the value is a plain object
|
|
1140
1154
|
*/
|
|
1141
1155
|
declare function isPlainObject(value: unknown): value is PlainObject;
|
|
@@ -1148,9 +1162,9 @@ declare function isPlainObject(value: unknown): value is PlainObject;
|
|
|
1148
1162
|
* // => true
|
|
1149
1163
|
* isUrl('google.com')
|
|
1150
1164
|
* // => false
|
|
1151
|
-
* @param str
|
|
1165
|
+
* @param str The string to check.
|
|
1152
1166
|
* @returns Returns `true` if given string is a valid URL, else `false`.
|
|
1153
1167
|
*/
|
|
1154
1168
|
declare function isUrl(str: string): boolean;
|
|
1155
1169
|
|
|
1156
|
-
export { ArrayMinLength, GenericFunction, PlainObject, Queue, average, camelCase, capitalize, chunk, count, debounce, deburr, decDebounce, decMaxCalls, decMemoize, decMinCalls, decThrottle, difference, dropRightWhile, dropWhile, escapeHtml, escapeRegExp, group, intersection, isEmpty, isEqual, isPlainObject, isUrl, kebabCase, maxCalls, median, memoize, merge, minCalls, omit, pascalCase, pick, races, randomFloat, randomInt, range, retry, sample, set, shuffle, sleep, snakeCase, sort, splitWords, sum, takeRightWhile, takeWhile, throttle, timeout, times, titleCase, toDecorator, unescapeHtml, unique };
|
|
1170
|
+
export { ArrayMinLength, GenericFunction, PlainObject, Queue, average, camelCase, capitalize, chunk, count, debounce, deburr, decDebounce, decMaxCalls, decMemoize, decMinCalls, decThrottle, difference, dropRightWhile, dropWhile, escapeHtml, escapeRegExp, group, intersection, isEmpty, isEqual, isPlainObject, isUrl, kebabCase, maxCalls, median, memoize, merge, minCalls, omit, pascalCase, pick, races, randomFloat, randomInt, range, retry, round, sample, set, shuffle, sleep, snakeCase, sort, splitWords, sum, takeRightWhile, takeWhile, throttle, timeout, times, titleCase, toDecorator, unescapeHtml, unique };
|
package/dist/index.js
CHANGED
|
@@ -394,6 +394,12 @@ function randomInt(min, max) {
|
|
|
394
394
|
return min + randomBuffer[0] % range2;
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
+
// src/number/round.ts
|
|
398
|
+
function round(number, precision = 2) {
|
|
399
|
+
const factor = Math.pow(10, precision);
|
|
400
|
+
return Math.round((number + Number.EPSILON) * factor) / factor;
|
|
401
|
+
}
|
|
402
|
+
|
|
397
403
|
// src/object/merge.ts
|
|
398
404
|
function merge(target, ...sources) {
|
|
399
405
|
const targetCopy = { ...target };
|
|
@@ -448,7 +454,7 @@ var Queue = class {
|
|
|
448
454
|
queue = [];
|
|
449
455
|
/**
|
|
450
456
|
* @constructor
|
|
451
|
-
* @param maxConcurrent
|
|
457
|
+
* @param maxConcurrent The maximum number of async functions to run concurrently.
|
|
452
458
|
*/
|
|
453
459
|
constructor(maxConcurrent) {
|
|
454
460
|
this.maxConcurrent = maxConcurrent;
|
|
@@ -750,6 +756,7 @@ export {
|
|
|
750
756
|
randomInt,
|
|
751
757
|
range,
|
|
752
758
|
retry,
|
|
759
|
+
round,
|
|
753
760
|
sample,
|
|
754
761
|
set,
|
|
755
762
|
shuffle,
|