atomic-fns 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/.firebaserc +5 -0
  2. package/README.md +9 -4
  3. package/firebase.json +10 -0
  4. package/package.json +9 -9
  5. package/src/collections/index.d.ts +672 -0
  6. package/src/collections/index.js +1091 -0
  7. package/src/collections/index.ts +1186 -0
  8. package/src/datetime/index.d.ts +6 -0
  9. package/src/datetime/index.js +6 -0
  10. package/src/datetime/index.ts +7 -0
  11. package/src/functools/index.d.ts +107 -0
  12. package/src/functools/index.js +219 -0
  13. package/src/functools/index.ts +255 -0
  14. package/src/globals/index.d.ts +286 -0
  15. package/src/globals/index.js +388 -0
  16. package/src/globals/index.ts +451 -0
  17. package/src/index.d.ts +8 -7
  18. package/src/index.js +8 -7
  19. package/src/index.ts +8 -7
  20. package/src/itertools/index.d.ts +225 -0
  21. package/src/itertools/index.js +449 -0
  22. package/src/itertools/index.ts +471 -0
  23. package/src/math/index.d.ts +97 -0
  24. package/src/math/index.js +92 -0
  25. package/src/math/index.ts +152 -0
  26. package/src/{operators.d.ts → operators/index.d.ts} +11 -9
  27. package/src/operators/index.js +171 -0
  28. package/src/operators/index.ts +175 -0
  29. package/src/random/index.d.ts +42 -0
  30. package/src/random/index.js +65 -0
  31. package/src/random/index.ts +66 -0
  32. package/tests/collections.spec.ts +42 -25
  33. package/tests/globals.spec.ts +56 -60
  34. package/tests/itertools.spec.ts +176 -4
  35. package/tests/math.spec.ts +25 -0
  36. package/tests/operators.spec.ts +1 -26
  37. package/tests/random.spec.ts +46 -0
  38. package/tsconfig.json +12 -4
  39. package/src/collections.d.ts +0 -228
  40. package/src/collections.js +0 -553
  41. package/src/collections.ts +0 -641
  42. package/src/datetime.d.ts +0 -5
  43. package/src/datetime.js +0 -5
  44. package/src/datetime.ts +0 -6
  45. package/src/functools.d.ts +0 -40
  46. package/src/functools.js +0 -78
  47. package/src/functools.ts +0 -93
  48. package/src/globals.d.ts +0 -179
  49. package/src/globals.js +0 -309
  50. package/src/globals.ts +0 -377
  51. package/src/itertools.d.ts +0 -20
  52. package/src/itertools.js +0 -98
  53. package/src/itertools.ts +0 -116
  54. package/src/math.d.ts +0 -16
  55. package/src/math.js +0 -70
  56. package/src/math.ts +0 -77
  57. package/src/objects.d.ts +0 -0
  58. package/src/objects.js +0 -1
  59. package/src/objects.ts +0 -0
  60. package/src/operators.js +0 -109
  61. package/src/operators.ts +0 -130
  62. package/src/random.d.ts +0 -22
  63. package/src/random.js +0 -48
  64. package/src/random.ts +0 -53
  65. package/src/strings.d.ts +0 -0
  66. package/src/strings.js +0 -1
  67. package/src/strings.ts +0 -0
  68. package/src/util.d.ts +0 -0
  69. package/src/util.js +0 -1
  70. package/src/util.ts +0 -0
@@ -1,641 +0,0 @@
1
- /**
2
- * Collections
3
- * @module
4
- */
5
- import {
6
- call,
7
- Function,
8
- get,
9
- isArray,
10
- isArrayLike,
11
- isBool,
12
- isEmpty,
13
- isFunc,
14
- isNull,
15
- isNumber,
16
- isObject,
17
- isString,
18
- Iteratee,
19
- keys,
20
- NotImplementedError,
21
- set
22
- } from './globals.js'
23
- import { comp, eq, id } from './operators.js'
24
-
25
- /**
26
- * A container type that provides contains().
27
- *
28
- *
29
- * @interface Container
30
- */
31
- export interface Container {
32
- contains: (x) => boolean
33
- }
34
-
35
- /**
36
- * These are the "rich comparison" methods, inspired by Python operators.
37
- *
38
- *
39
- * @interface Comparable
40
- */
41
- export interface Comparable {
42
- /** x < y: calls this.lt(other) reflection. */
43
- lt?: (other) => boolean
44
- /** x ≤ y: calls this.le(other) reflection. */
45
- le?: (other) => boolean
46
- /** x == y: calls this.eq(other) reflection. */
47
- eq: (other) => boolean
48
- /** x != y: calls this.ne(other) reflection. */
49
- ne: (other) => boolean
50
- /** x > y: calls this.gt(other) reflection. */
51
- gt?: (other) => boolean
52
- /** x ≥ y: calls this.ge(other) reflection. */
53
- ge?: (other) => boolean
54
- }
55
-
56
- /**
57
- * A Collection is an iterable container type.
58
- * This is an abstract base class for user-defined collection types.
59
- *
60
- *
61
- * @abstract
62
- * @class Collection
63
- * @implements {Container}
64
- */
65
- export abstract class Collection implements Container {
66
- /**
67
- * Returns an iterator for the container items
68
- * @return {Iterator}
69
- */
70
- [Symbol.iterator]() {
71
- return this
72
- }
73
-
74
- /**
75
- * Implements the iterator protocol and returns the next item in the iterable.
76
- */
77
- next() {}
78
-
79
- /**
80
- * Adds a new item to the container.
81
- * @param item
82
- */
83
- add(item) {}
84
-
85
- /**
86
- * Checks if item is present in the container.
87
- * @param item
88
- */
89
- contains(item) {
90
- return false
91
- }
92
-
93
- /**
94
- * Returns the total number of elements in the container.
95
- */
96
- size(): number {
97
- throw new NotImplementedError()
98
- }
99
-
100
- /**
101
- * Remove the first item from the container where `item == x`
102
- * @raises ValueError when x is not found
103
- */
104
- remove(x) {}
105
-
106
- /**
107
- * Retrieve and remove the item at index `i`.
108
- * @returns the item or undefined if not found.
109
- */
110
- pop(i) {}
111
-
112
- /**
113
- * Remove all items from the container
114
- */
115
- clear() {}
116
- }
117
-
118
- /**
119
- * Implements an iterable that allows backward iteration.
120
- * @interface Reversible
121
- */
122
- export interface Reversible<T = unknown> {
123
- reversed: () => Iterator<T>
124
- }
125
-
126
- /**
127
- * A sequence is an iterable type with efficient index-based access.
128
- *
129
- *
130
- * @abstract
131
- * @class Sequence
132
- * @extends {Collection}
133
- * @template T
134
- */
135
- export abstract class Sequence<T> extends Collection implements Reversible<T> {
136
- /**
137
- * Return the item at the given key or index
138
- * @param {*} key
139
- * @memberof Sequence
140
- */
141
- get(key): T | undefined {
142
- throw new NotImplementedError()
143
- }
144
-
145
- /**
146
- * Set a new value at the given key or index
147
- *
148
- * @param {*} key
149
- * @param {T} val
150
- * @memberof Sequence
151
- */
152
- set(key, val: T) {
153
- throw new NotImplementedError()
154
- }
155
-
156
- /**
157
- * Deletes the given key or index, and its value.
158
- * Raises ValueError if not key is found.
159
- *
160
- * @param {*} key
161
- * @memberof Sequence
162
- */
163
- delete(key) {
164
- throw new NotImplementedError()
165
- }
166
-
167
- /**
168
- * Adds a new item to the end of the sequence.
169
- *
170
- * @param {T} x
171
- * @memberof Sequence
172
- */
173
- append(x: T) {}
174
-
175
- /**
176
- * Append all the items to the sequence.
177
- *
178
- * @param {Iterable<T>} iter
179
- * @memberof Sequence
180
- */
181
- extend(iter: Iterable<T>) {}
182
-
183
- /**
184
- * Return the index of x in the sequence, or undefined if not found.
185
- *
186
- * @param {T} item
187
- * @return {(number | undefined)}
188
- * @memberof Sequence
189
- */
190
- indexOf(item: T): number | undefined {
191
- throw new NotImplementedError()
192
- }
193
-
194
- size() {
195
- return 0
196
- }
197
-
198
- reversed(): Iterator<T> {
199
- throw new NotImplementedError()
200
- }
201
- }
202
-
203
- /**
204
- * Returns a new immutable Set object with elements from `iterable`. Its contents cannot be altered after it's created.
205
- *
206
- *
207
- * @class FrozenSet
208
- * @extends {Set<T>}
209
- * @template T
210
- */
211
- export class FrozenSet<T = any> extends Set<T> {
212
- constructor(iterable: Iterable<T>) {
213
- super(iterable)
214
- return this.freeze()
215
- }
216
-
217
- add() {
218
- throw TypeError('FrozenSet cannot be modified.')
219
- return this // eslint-disable-line
220
- }
221
-
222
- delete() {
223
- throw TypeError('FrozenSet cannot be modified.')
224
- return false // eslint-disable-line
225
- }
226
-
227
- clear() {
228
- throw TypeError('FrozenSet cannot be modified.')
229
- return this // eslint-disable-line
230
- }
231
-
232
- freeze() {
233
- return Object.freeze(this)
234
- }
235
- }
236
-
237
- export const compact = (...arr) => arr.filter((x) => !isEmpty(x))
238
-
239
- /**
240
- * Creates a function that can be used to create named tuple-like objects.
241
- * @example
242
- * ```
243
- * let Point = namedtuple('x', 'y', 'z')
244
- * let userObj = User(0, 0, 0)
245
- * // -> {x: 0, y: 0, z: 0}
246
- * ```
247
- *
248
- *
249
- * @param {...string[]} fields
250
- * @return
251
- */
252
- export function namedtuple(...fields: string[]) {
253
- return (...args) => fields.reduce((prev, f, i) => set(prev, f, args[i], false, true), {})
254
- }
255
-
256
- export function filter(arr, fn: Iteratee | PropertyKey | Object = isNull) {
257
- if (Array.isArray(arr)) {
258
- // @ts-expect-error function is not compatible?
259
- if (typeof fn === 'function') return arr.filter(fn)
260
- if (typeof fn === 'string') return arr.filter((x) => get(x, fn))
261
- if (isObject(fn)) return arr.filter(matches(fn))
262
- }
263
- }
264
-
265
- export function find(arr, fn: Iteratee | PropertyKey | Object) {
266
- if (Array.isArray(arr)) {
267
- if (typeof fn === 'function') return arr.find(fn as Iteratee)
268
- if (typeof fn === 'string') return arr.find((x) => x?.[fn])
269
- if (isObject(fn)) return arr.find(matches(fn))
270
- }
271
- }
272
-
273
- export function findRight(arr, fn: Iteratee | PropertyKey | Object) {
274
- if (Array.isArray(arr)) {
275
- for (let i = arr.length - 1; i >= 0; i--) {
276
- const x = arr[i]
277
- if (typeof fn === 'function') {
278
- if (fn(x)) return x
279
- } else if (typeof fn === 'string') {
280
- if (x?.[fn]) return x
281
- } else if (isObject(fn)) {
282
- if (matches(fn)(x)) return x
283
- }
284
- }
285
- }
286
- }
287
-
288
- export const matches = (o) => (x) => {
289
- if (!o || !x) return false
290
- for (const key in o) {
291
- if (!eq(x[key], o[key])) return false
292
- }
293
- return true
294
- }
295
-
296
- export function forEach(arr: any[], fn: Iteratee)
297
- export function forEach(arr: Object, fn: Iteratee)
298
- export function forEach(arr: any, fn: any) {
299
- if (Array.isArray(arr)) return arr.forEach(fn)
300
- if (isObject(arr)) {
301
- return Object.keys(arr).forEach((key) => fn(get(arr, key), key, arr))
302
- }
303
- }
304
-
305
- export function flatten(arr, depth: boolean | number = 1) {
306
- if (!depth) return arr
307
- if (Array.isArray(arr)) return flattenArray(arr, depth, [])
308
- if (isObject(arr)) return flattenObj(arr)
309
- return arr
310
- }
311
-
312
- export function flattenArray(arr: any[], depth: boolean | number = 1, result: any[] = []) {
313
- for (const value of arr) {
314
- if (depth && Array.isArray(value)) {
315
- flattenArray(value, typeof depth === 'number' ? depth - 1 : depth, result)
316
- } else {
317
- result.push(value)
318
- }
319
- }
320
- return result
321
- }
322
-
323
- export function flattenObj(o: any, prefix = '', result = {}, keepNull = false) {
324
- if (isString(o) || isNumber(o) || isBool(o) || (keepNull && isNull(o))) {
325
- result[prefix] = o
326
- return result
327
- }
328
-
329
- if (isArray(o) || isObject(o)) {
330
- for (const i in o) {
331
- let pref = prefix
332
- if (isArray(o)) {
333
- pref = pref + `[${i}]`
334
- } else {
335
- if (isEmpty(prefix)) {
336
- pref = i
337
- } else {
338
- pref = prefix + '.' + i
339
- }
340
- }
341
- flattenObj(o[i], pref, result, keepNull)
342
- }
343
- return result
344
- }
345
- return result
346
- }
347
-
348
- export const map = (arr, fn: Function | string) => {
349
- if (Array.isArray(arr)) {
350
- return arr.map((x, i) => {
351
- if (typeof fn === 'string') return x[fn]
352
- return fn(x, i, arr)
353
- })
354
- }
355
- if (isObject(arr)) {
356
- return Object.keys(arr).map((key) => {
357
- if (typeof fn === 'string') return get(arr[key], fn)
358
- return fn(arr[key], key, arr)
359
- })
360
- }
361
- }
362
-
363
- export function pick(obj, paths: Iteratee | string[]) {
364
- if (obj == null) {
365
- return {}
366
- }
367
- const result = {}
368
- if (Array.isArray(paths)) {
369
- for (const key of paths) {
370
- result[key] = obj[key]
371
- }
372
- return result
373
- } else if (typeof paths === 'function') {
374
- for (const key in obj) {
375
- const value = obj[key]
376
- if (paths(value, key)) result[key] = value
377
- }
378
- }
379
- return result
380
- }
381
-
382
- export function omit(obj, paths: Iteratee | string[]) {
383
- const result = {}
384
- for (const key in obj) {
385
- const value = obj[key]
386
- if (Array.isArray(paths) && !paths.includes(key)) {
387
- result[key] = value
388
- } else if (typeof paths === 'function' && !paths(value, key)) {
389
- result[key] = value
390
- }
391
- }
392
- return result
393
- }
394
-
395
- export function contains(arr, y) {
396
- const op = call(arr, 'contains', y)
397
- if (op != null) return op
398
- return indexOf(arr, y) >= 0
399
- }
400
-
401
- export function indexOf(obj, x, start = 0) {
402
- if (obj == null) return
403
- const op = call(obj, 'indexOf', x, start)
404
- if (op != null) return op
405
- const length = obj.length
406
- if (length && start < 0) {
407
- start = Math.max(start + length, 0)
408
- }
409
- if (!length || start >= length) return -1
410
- for (; start < length; start++) {
411
- if (eq(x, obj[start])) return start
412
- }
413
- return -1
414
- }
415
-
416
- export function lastIndexOf(obj, x, start?) {
417
- if (obj == null) return
418
- const op = call(obj, 'lastIndexOf', x, start)
419
- if (op != null) return op
420
- const length = obj.length
421
- if (start == null) start = length - 1
422
- if (!length || start < 0) return -1
423
- for (; start >= 0; start--) {
424
- if (eq(x, obj[start])) return start
425
- }
426
- return -1
427
- }
428
-
429
- /**
430
- * Creates a clone of the given `obj`. If `deep` is `true` it will clone it recursively.
431
- *
432
- *
433
- * @param {*} obj
434
- * @param {boolean} [deep=false]
435
- * @return The clone value
436
- */
437
- export function clone(obj, deep = false) {
438
- if (ArrayBuffer.isView(obj)) {
439
- return cloneTypedArray(obj, deep)
440
- }
441
- if (isArray(obj) || isArrayLike(obj)) {
442
- return cloneArray(obj, deep)
443
- }
444
- if (isObject(obj)) {
445
- if (isFunc(obj.clone)) {
446
- return obj.clone()
447
- }
448
- const copy = {}
449
- for (const key of keys(obj)) {
450
- if (deep) {
451
- copy[key] = clone(obj[key], deep)
452
- } else {
453
- copy[key] = obj[key]
454
- }
455
- }
456
- return copy
457
- }
458
- return obj
459
- }
460
-
461
- export function cloneArray(arr, deep = false) {
462
- if (!deep) return Array.from(arr)
463
- return arr.map((item) => clone(item, deep))
464
- }
465
-
466
- export function cloneArrayBuffer(arrayBuffer) {
467
- const result = new arrayBuffer.constructor(arrayBuffer.byteLength)
468
- new Uint8Array(result).set(new Uint8Array(arrayBuffer))
469
- return result
470
- }
471
-
472
- export function cloneTypedArray(typedArray, isDeep) {
473
- const buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer
474
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length)
475
- }
476
-
477
- export function uniq<T = any>(arr: T[], fn: string | Iteratee = id) {
478
- const keys = new Set<T>()
479
- for (const x of arr) {
480
- if (typeof fn === 'function') {
481
- keys.add(fn(x))
482
- } else {
483
- keys.add(get(x, fn))
484
- }
485
- }
486
- return Array.from(keys.values())
487
- }
488
-
489
- export function sortedUniq(arr, fn: string | Iteratee = id) {
490
- const lst = uniq(arr, fn)
491
- lst.sort(comp)
492
- return lst
493
- }
494
-
495
- function baseMergeDeep(obj, source, key, stack) {
496
- const objValue = obj[key]
497
- const srcValue = source[key]
498
- const stacked = stack.get(srcValue)
499
- if (stacked && (objValue !== stacked || !(key in obj))) {
500
- obj[key] = stacked
501
- return
502
- }
503
-
504
- let newValue: any
505
- let isCommon = newValue === undefined
506
- const isArray = Array.isArray(srcValue)
507
- const isTyped = ArrayBuffer.isView(srcValue)
508
-
509
- if (isArray || isTyped) {
510
- if (Array.isArray(objValue)) {
511
- newValue = objValue
512
- } else if (isArrayLike(objValue)) {
513
- newValue = Array.from(objValue)
514
- } else if (isTyped) {
515
- isCommon = false
516
- newValue = cloneTypedArray(srcValue, true)
517
- } else {
518
- newValue = []
519
- }
520
- } else if (isObject(srcValue)) {
521
- newValue = objValue
522
- if (!isObject(objValue)) {
523
- newValue = srcValue
524
- }
525
- } else {
526
- isCommon = false
527
- }
528
- if (isCommon) {
529
- stack.set(srcValue, newValue)
530
- baseMerge(newValue, srcValue, stack)
531
- stack.delete(srcValue)
532
- }
533
- obj[key] = newValue
534
- }
535
-
536
- function baseMerge(obj, source, stack?) {
537
- if (obj === source) return obj
538
- for (const key in source) {
539
- const srcValue = source[key]
540
- const objValue = obj[key]
541
- if (typeof srcValue === 'object' && srcValue !== null) {
542
- baseMergeDeep(obj, source, key, stack || new WeakMap())
543
- } else {
544
- if (objValue !== srcValue) {
545
- obj[key] = srcValue
546
- }
547
- }
548
- }
549
- }
550
-
551
- /**
552
- * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. Source properties that resolve to `undefined` are skipped if a destination value exists. Array and plain object properties are merged recursively. Other objects and value types are overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.
553
- *
554
- * Note: this method mutates `obj`
555
- *
556
- *
557
- * @param {Object} obj
558
- * @param {...Object} sources
559
- * @return {Object} The destination object.
560
- */
561
- export function merge(obj, ...sources): Object {
562
- for (const source of sources) {
563
- baseMerge(obj, source)
564
- }
565
- return obj
566
- }
567
-
568
- export function* difference(...args) {
569
- const sets = args.map((arr) => new Set(arr))
570
- const setA = sets[0]
571
-
572
- for (let i = 1; i < sets.length; i++) {
573
- for (const x of sets[i].values()) {
574
- if (!setA.delete(x)) setA.add(x)
575
- }
576
- }
577
-
578
- for (const x of setA.values()) {
579
- yield x
580
- }
581
- }
582
-
583
- export function* intersection(...args) {
584
- const sets = args.map((arr) => new Set(arr))
585
- // build a counter map to find items in all
586
- const results = new Map()
587
- const total = sets.length
588
-
589
- for (let i = 0; i < total; i++) {
590
- for (const x of sets[i].values()) {
591
- const count = results.get(x) || 0
592
- results.set(x, count + 1)
593
- }
594
- }
595
-
596
- for (const [key, value] of results.entries()) {
597
- if (value === total) yield key
598
- }
599
- }
600
-
601
- export function* union(...args) {
602
- const results = new Set()
603
- for (const arr of args) {
604
- for (const item of arr) {
605
- results.add(item)
606
- }
607
- }
608
- for (const item of results.values()) {
609
- yield item
610
- }
611
- }
612
-
613
- /**
614
- * Creates an object composed of keys generated from the results of running each element of `arr` thru `func`. The order of grouped values is determined by the order they occur in `arr`. The corresponding value of each key is an array of elements responsible for generating the key.
615
- *
616
- *
617
- * @param {(any[] | Object)} arr The collection to iterate over.
618
- * @param {(Iteratee | PropertyKey)} [func=id] The iteratee to transform keys.
619
- * @return {Object} Returns the composed aggregate object.
620
- */
621
- export function groupBy(arr: any[] | Object, func: Iteratee | PropertyKey = id): Object {
622
- const results = {}
623
- if (Array.isArray(arr)) {
624
- for (let i = 0; i < arr.length; i++) {
625
- const item = arr[i]
626
- const groupKey = typeof func === 'function' ? func(item, i) : get(item, func)
627
- const values = results[groupKey] || []
628
- values.push(item)
629
- results[groupKey] = values
630
- }
631
- } else {
632
- for (const k in arr) {
633
- const item = arr[k]
634
- const groupKey = typeof func === 'function' ? func(item, k) : get(item, func)
635
- const values = results[groupKey]
636
- values.push(item)
637
- results[groupKey] = values
638
- }
639
- }
640
- return results
641
- }
package/src/datetime.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Date
3
- * @module
4
- */
5
- export declare const now: number;
package/src/datetime.js DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Date
3
- * @module
4
- */
5
- export const now = new Date().getTime()
package/src/datetime.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Date
3
- * @module
4
- */
5
-
6
- export const now = new Date().getTime()
@@ -1,40 +0,0 @@
1
- /**
2
- * FP
3
- * @module
4
- */
5
- import { Function } from './globals.js';
6
- export declare const bind: (fn: any, self: any, ...args: any[]) => any;
7
- export declare const partial: (fn: any, ...args: any[]) => any;
8
- export declare const flow: (...args: any[]) => (x: any) => any;
9
- export declare const pipe: (...args: any[]) => (x: any) => any;
10
- export declare const compose: (...args: any[]) => (x: any) => any;
11
- /**
12
- * Creates a function that memoizes the result of `func`. If `resolver` is provided, it determines the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the map cache key.
13
- *
14
- *
15
- * @param {Function} func The function to have its output memoized.
16
- * @param {Function} [resolver] The function to resolve the cache key.
17
- * @return {Function} Returns the new memoized function.
18
- */
19
- export declare function memoize(func: Function, resolver?: Function): Function;
20
- /**
21
- * Creates a debounced function that delays invoking `func` until after `wait` milliseconds have elapsed since the last time the debounced function was invoked. Subsequent calls to the debounced function return the result of the last successful invocation. Provide options to set the `maxWait` milliseconds, regardless of when the function was last invoked.
22
- *
23
- *
24
- * @param {Function} func The function to debounce.
25
- * @param {number} wait The number of milliseconds to delay.
26
- * @param {{ maxWait: number }} { maxWait } The maximum time `func` is allowed to be delayed before it's invoked.
27
- * @return {Function} Returns the new debounced function.
28
- */
29
- export declare function debounce(func: Function, wait: number, { maxWait }: {
30
- maxWait: number;
31
- }): Function;
32
- /**
33
- * Creates a throttled function that only invokes `func` at most once per every `wait` milliseconds. Subsequent calls to the throttled function return the result of the last successful invocation.
34
- *
35
- *
36
- * @param {Function} func The function to throttle.
37
- * @param {number} time The number of milliseconds to throttle invocations to.
38
- * @return {Function} Returns the new throttled function.
39
- */
40
- export declare function throttle(func: Function, time: number): Function;