atomic-fns 1.1.6 → 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.
Files changed (51) hide show
  1. package/README.md +51 -12
  2. package/dist/collections/BTree.d.ts +11 -10
  3. package/dist/collections/BTree.js +58 -80
  4. package/dist/collections/Heap.d.ts +2 -2
  5. package/dist/collections/Heap.js +1 -1
  6. package/dist/collections/LRUCache.d.ts +8 -5
  7. package/dist/collections/LRUCache.js +24 -11
  8. package/dist/collections/SortedMap.d.ts +4 -4
  9. package/dist/collections/SortedMap.js +4 -3
  10. package/dist/collections/SortedSet.d.ts +2 -2
  11. package/dist/collections/SortedTree.d.ts +9 -9
  12. package/dist/collections/SortedTree.js +7 -6
  13. package/dist/collections/SplayTree.d.ts +17 -15
  14. package/dist/collections/SplayTree.js +42 -29
  15. package/dist/collections/Trie.d.ts +2 -2
  16. package/dist/collections/Trie.js +26 -26
  17. package/dist/collections/deque.d.ts +11 -11
  18. package/dist/collections/deque.js +17 -10
  19. package/dist/collections/frozenset.js +4 -1
  20. package/dist/collections/index.d.ts +30 -48
  21. package/dist/collections/index.js +210 -82
  22. package/dist/decimal/index.d.ts +7 -5
  23. package/dist/decimal/index.js +63 -28
  24. package/dist/functools/index.d.ts +10 -34
  25. package/dist/functools/index.js +25 -57
  26. package/dist/globals/index.d.ts +5 -22
  27. package/dist/globals/index.js +24 -40
  28. package/dist/i18n/currency.d.ts +10 -7
  29. package/dist/i18n/currency.js +22 -7
  30. package/dist/i18n/date/index.d.ts +22 -16
  31. package/dist/i18n/date/index.js +89 -67
  32. package/dist/i18n/date/utils.d.ts +6 -7
  33. package/dist/i18n/date/utils.js +15 -113
  34. package/dist/i18n/duration.d.ts +13 -12
  35. package/dist/i18n/duration.js +38 -32
  36. package/dist/i18n/format.d.ts +10 -2
  37. package/dist/i18n/format.js +100 -217
  38. package/dist/i18n/index.d.ts +2 -1
  39. package/dist/itertools/index.d.ts +21 -25
  40. package/dist/itertools/index.js +41 -44
  41. package/dist/math/index.d.ts +12 -29
  42. package/dist/math/index.js +16 -33
  43. package/dist/mod.d.ts +1 -0
  44. package/dist/mod.js +1 -0
  45. package/dist/operators/index.d.ts +3 -3
  46. package/dist/operators/index.js +62 -38
  47. package/dist/random/index.js +9 -6
  48. package/dist/string/index.d.ts +1 -1
  49. package/dist/string/index.js +2 -4
  50. package/dist/types.d.ts +3 -3
  51. package/package.json +16 -21
@@ -1,11 +1,14 @@
1
+ import { itake } from '../itertools/index.js';
1
2
  import { Collection } from './abc.js';
2
- function* traverse(node, path, total = 20, count = 0) {
3
- if (node.isWord) {
4
- count++;
5
- yield path;
6
- }
7
- for (const key of Object.keys(node)) {
8
- yield* traverse(node[key], path + key, total, count);
3
+ function* traverse(root, prefix) {
4
+ const stack = [[root, prefix]];
5
+ while (stack.length) {
6
+ const [node, path] = stack.pop();
7
+ if (node.isWord)
8
+ yield path;
9
+ for (const key of Object.keys(node).reverse()) {
10
+ stack.push([node[key], path + key]);
11
+ }
9
12
  }
10
13
  }
11
14
  /**
@@ -14,7 +17,7 @@ function* traverse(node, path, total = 20, count = 0) {
14
17
  * @see {@link https://en.wikipedia.org/wiki/Trie Trie}
15
18
  */
16
19
  export class Trie extends Collection {
17
- root = {};
20
+ root = Object.create(null);
18
21
  count = 0;
19
22
  constructor(words) {
20
23
  super();
@@ -33,16 +36,17 @@ export class Trie extends Collection {
33
36
  for (let i = 0; i < word.length; i++) {
34
37
  const c = word[i];
35
38
  if (!current[c])
36
- current[c] = {};
39
+ current[c] = Object.create(null);
37
40
  current = current[c];
38
41
  }
42
+ if (!current.isWord)
43
+ this.count++;
39
44
  // Set as end of the word
40
45
  Object.defineProperty(current, 'isWord', {
41
46
  value: true,
42
47
  enumerable: false,
43
48
  writable: true
44
49
  });
45
- this.count++;
46
50
  return this;
47
51
  }
48
52
  /**
@@ -51,15 +55,12 @@ export class Trie extends Collection {
51
55
  * @returns {boolean} Returns `true` if the string was found and removed.
52
56
  */
53
57
  remove(word) {
54
- for (let i = 0, node = this.root; i < word.length && node; i++) {
55
- node = node[word[i]];
56
- if (i === word.length - 1 && node.isWord) {
57
- node.isWord = false;
58
- this.count--;
59
- return true;
60
- }
61
- }
62
- return false;
58
+ const node = this.findNode(word);
59
+ if (!node?.isWord)
60
+ return false;
61
+ node.isWord = false;
62
+ this.count--;
63
+ return true;
63
64
  }
64
65
  findNode(word) {
65
66
  let node = this.root;
@@ -72,13 +73,12 @@ export class Trie extends Collection {
72
73
  /**
73
74
  * Generates all results that start with the given string.
74
75
  * @param word A prefix string
75
- * @param {number} [limit=20] The number of results to return.
76
+ * @param {number} [limit] The number of results to return. Defaults to every result.
76
77
  */
77
- matches = function* (word, limit = 20) {
78
+ matches = function* (word, limit) {
78
79
  const node = this.findNode(word);
79
- if (node) {
80
- yield* traverse(node, word, limit);
81
- }
80
+ if (node)
81
+ yield* itake(limit ?? Infinity, traverse(node, word));
82
82
  };
83
83
  /**
84
84
  * Returns `true` if the given string is found in the tree.
@@ -86,13 +86,13 @@ export class Trie extends Collection {
86
86
  */
87
87
  contains(word) {
88
88
  const node = this.findNode(word);
89
- return node?.isWord;
89
+ return !!node?.isWord;
90
90
  }
91
91
  /**
92
92
  * Removes all strings from the tree.
93
93
  */
94
94
  clear() {
95
- this.root = {};
95
+ this.root = Object.create(null);
96
96
  this.count = 0;
97
97
  }
98
98
  /**
@@ -1,4 +1,4 @@
1
- import { Iteratee } from '../types.js';
1
+ import type { Iteratee } from '../types.js';
2
2
  import { Sequence } from './abc.js';
3
3
  /**
4
4
  * Fixed capacity double-ended queue implemented as ring deque.
@@ -44,28 +44,28 @@ export declare class Deque<T = any> extends Sequence<T> {
44
44
  * Removes and returns the element at the end of the deque.
45
45
  * @returns {?T} Returns the popped item.
46
46
  */
47
- pop(): T;
47
+ pop(): T | undefined;
48
48
  /**
49
49
  * Alias of {@link Deque.pop}
50
50
  * @returns {?T} Returns the popped item.
51
51
  */
52
- remove(): T;
52
+ remove(): T | undefined;
53
53
  /**
54
54
  * Removes and returns the element at the beginning of the deque.
55
55
  * @returns {?T} Returns the removed deque element.
56
56
  */
57
- popleft(): T;
57
+ popleft(): T | undefined;
58
58
  /**
59
59
  * Returns the element at the beginning of the deque.
60
60
  * @returns {?T} The element if exists
61
61
  */
62
- first(): T;
62
+ first(): T | undefined;
63
63
  /**
64
64
  * Returns the element at a specified index position in the deque.
65
65
  * @param {number} index The given index
66
66
  * @returns {?T} The element if exists
67
67
  */
68
- get(index: any): T;
68
+ get(index: any): T | undefined;
69
69
  /**
70
70
  * Update the element at a given `index`.
71
71
  * @param {number} index The given index
@@ -82,7 +82,7 @@ export declare class Deque<T = any> extends Sequence<T> {
82
82
  * @param {Iteratee<T>} iteratee A function that will be invoked per element
83
83
  * @returns {?T} The element if exists
84
84
  */
85
- find(iteratee: Iteratee<T>): T;
85
+ find(iteratee: Iteratee<T>): T | undefined;
86
86
  /**
87
87
  * Calls `iteratee` function for every element in the deque.
88
88
  * @param {Iteratee<T>} iteratee A function that will be invoked per element
@@ -92,12 +92,12 @@ export declare class Deque<T = any> extends Sequence<T> {
92
92
  * Returns a new array with all the elements in reverse order.
93
93
  * @returns {Array<T>} The elements reversed
94
94
  */
95
- reversed(): any;
95
+ reversed(): T[];
96
96
  /**
97
97
  * Returns a new array with all the elements in the order they were added to the deque.
98
98
  * @returns {Array<T>} The elements array
99
99
  */
100
- toArray(): any;
100
+ toArray(): T[];
101
101
  /**
102
102
  * Returns an iterator over the deque's values.
103
103
  * @returns {Iterator}
@@ -111,7 +111,7 @@ export declare class Deque<T = any> extends Sequence<T> {
111
111
  * Creates an iterator of `[index, value]` pairs for all elements in the deque.
112
112
  * @returns {Iterator}
113
113
  */
114
- entries(): Iterable<[number, T]> & Iterator<[number, T], any, undefined>;
114
+ entries(): Iterable<[number, T]>;
115
115
  [Symbol.iterator](): Iterable<T>;
116
- inspect(): any;
116
+ inspect(): T[];
117
117
  }
@@ -1,7 +1,14 @@
1
1
  import { KeyError, ValueError } from '../globals/index.js';
2
- import { IterableIterator } from '../itertools/index.js';
3
2
  import { eq } from '../operators/index.js';
4
3
  import { Sequence } from './abc.js';
4
+ function IterableIterator(next) {
5
+ return {
6
+ next,
7
+ [Symbol.iterator]() {
8
+ return this;
9
+ }
10
+ };
11
+ }
5
12
  /**
6
13
  * Fixed capacity double-ended queue implemented as ring deque.
7
14
  * @template T
@@ -23,7 +30,9 @@ export class Deque extends Sequence {
23
30
  throw new ValueError(`Deque capacity should be a positive integer.`);
24
31
  this.ArrayConstructor = arrType.constructor;
25
32
  this.capacity = capacity;
26
- this.items = new this.ArrayConstructor(arrType.length || this.capacity);
33
+ // A typed array cannot grow, so it takes the whole capacity up front
34
+ const length = ArrayBuffer.isView(arrType) ? capacity : arrType.length || capacity;
35
+ this.items = new this.ArrayConstructor(length);
27
36
  this.clear();
28
37
  if (arrType.length) {
29
38
  for (const item of arrType) {
@@ -125,14 +134,11 @@ export class Deque extends Sequence {
125
134
  * @returns {?T} The element if exists
126
135
  */
127
136
  get(index) {
128
- if (this.count === 0)
129
- return;
130
- index = this.start + index;
131
137
  if (index < 0)
132
138
  index += this.count;
133
- if (index > this.capacity)
134
- index -= this.capacity;
135
- return this.items[index];
139
+ if (index < 0 || index >= this.count)
140
+ return;
141
+ return this.items[(this.start + index) % this.capacity];
136
142
  }
137
143
  /**
138
144
  * Update the element at a given `index`.
@@ -141,9 +147,10 @@ export class Deque extends Sequence {
141
147
  set(index, value) {
142
148
  if (index < 0)
143
149
  index += this.count;
144
- if (index > this.count)
150
+ if (index < 0 || index >= this.count) {
145
151
  throw new KeyError(`Invalid index: ${index} not in Deque.`);
146
- this.items[index] = value;
152
+ }
153
+ this.items[(this.start + index) % this.capacity] = value;
147
154
  }
148
155
  /**
149
156
  * Check if a given element is in the deque.
@@ -8,7 +8,10 @@
8
8
  */
9
9
  export class FrozenSet extends Set {
10
10
  constructor(iterable) {
11
- super(iterable);
11
+ super();
12
+ // The Set constructor would call the no-op add below and drop every item
13
+ for (const item of iterable ?? [])
14
+ super.add(item);
12
15
  return this.freeze();
13
16
  }
14
17
  /** @private */
@@ -4,7 +4,7 @@
4
4
  * @module collections
5
5
  */
6
6
  import { compare } from '../operators/index.js';
7
- import { Iteratee } from '../types';
7
+ import type { Iteratee } from '../types.js';
8
8
  export * from './abc.js';
9
9
  export * from './BTree.js';
10
10
  export * from './deque.js';
@@ -38,7 +38,6 @@ export declare function compact<T>(arr: T): Partial<T>;
38
38
  count([6.1, 4.2, 6.3], Math.floor);
39
39
  // { '4': 1, '6': 2 }
40
40
 
41
- // property iteratee shorthand.
42
41
  count(['one', 'two', 'three'], x => x.length);
43
42
  // { '3': 2, '5': 1 }
44
43
  ```
@@ -86,7 +85,7 @@ let users = [
86
85
  { 'user': 'pebbles', 'age': 1, 'active': true }
87
86
  ]
88
87
 
89
- find(users, (o) => o.age < 40)
88
+ find(users, o => o.age < 40)
90
89
  // object for 'barney'
91
90
 
92
91
  // The shape iteratee shorthand.
@@ -142,16 +141,18 @@ export declare function matches(shape: any): (obj: any) => boolean;
142
141
  forEach([1, 2], (value) => {
143
142
  console.log(value)
144
143
  })
145
- // Logs `1` then `2`.
144
+ // 1
145
+ // 2
146
146
 
147
147
  forEach({ 'a': 1, 'b': 2 }, (value, key) => {
148
148
  console.log(key)
149
149
  })
150
- // Logs 'a' then 'b' (iteration order is not guaranteed).
150
+ // 'a'
151
+ // 'b'
151
152
  ```
152
153
  * @param {Array|Object} collection The collection to iterate over.
153
154
  * @param {Iteratee} fn The function invoked per iteration.
154
- * @returns {*} Returns `collection`.
155
+ * @returns {void}
155
156
  * @see {@link forEachRight}
156
157
  * @see {@link filter}
157
158
  * @see {@link map}
@@ -162,8 +163,8 @@ export declare function forEach<T>(collection: Object, fn: Iteratee<T>): void;
162
163
  * This method is like {@link find} except that it iterates from right to left.
163
164
  * @example
164
165
  ```js
165
- findLast([1, 2, 3, 4], (n) => n % 2 === 1)
166
- // => 3
166
+ findLast([1, 2, 3, 4], n => n % 2 === 1)
167
+ // 3
167
168
  ```
168
169
  * @param {Array} arr The collection to iterate over.
169
170
  * @param {Function} fn The function invoked per iteration.
@@ -179,14 +180,13 @@ export declare function findLast<T>(arr: Object, fn: Object): T | undefined;
179
180
 
180
181
  * @example
181
182
  ```js
182
- forEachRight([1, 2], (value) => {
183
- console.log(value)
184
- })
185
- // Logs `2` then `1`.
183
+ forEachRight([1, 2], console.log)
184
+ // 2
185
+ // 1
186
186
  ```
187
187
  * @param {Array|Object} collection The collection to iterate over.
188
188
  * @param {Iteratee} fn The function invoked per iteration.
189
- * @returns {*} Returns `collection`.
189
+ * @returns {void}
190
190
  * @see {@link forEach}
191
191
  * @see {@link filter}
192
192
  * @see {@link map}
@@ -276,7 +276,7 @@ let object = { a: 1, b: '2', c: 3 }
276
276
  pick(object, ['a', 'c'])
277
277
  // { a: 1, c: 3 }
278
278
 
279
- pick(object, (x) => isNumber(x))
279
+ pick(object, x => isNumber(x))
280
280
  // { a: 1, c: 3 }
281
281
  ```
282
282
  *
@@ -285,7 +285,7 @@ pick(object, (x) => isNumber(x))
285
285
  export declare function pick<T>(obj: T, paths: Iteratee): Partial<T>;
286
286
  export declare function pick<T>(obj: T, paths: PropertyKey[]): Partial<T>;
287
287
  /**
288
- * The opposite of {@link pick} - this method creates an object composed of the own and inherited enumerable property paths of `object` that are not omitted.
288
+ * The opposite of {@link pick} - this method creates an object composed of the own enumerable properties of `object` that are not omitted.
289
289
  * @example
290
290
  ```js
291
291
  let object = { 'a': 1, 'b': '2', 'c': 3 }
@@ -293,7 +293,7 @@ let object = { 'a': 1, 'b': '2', 'c': 3 }
293
293
  omit(object, ['a', 'c'])
294
294
  // { 'b': '2' }
295
295
 
296
- omit(object, (x) => isNumber(x))
296
+ omit(object, x => isNumber(x))
297
297
  // { 'b': '2' }
298
298
  ```
299
299
  * @param {Object} obj The source object.
@@ -317,7 +317,7 @@ let users = [
317
317
  { 'user': 'pebbles', 'active': true }
318
318
  ]
319
319
 
320
- findIndex(users, (o) => o.user == 'barney')
320
+ findIndex(users, o => o.user == 'barney')
321
321
  // 0
322
322
 
323
323
  // The `shape` iteratee shorthand.
@@ -368,7 +368,7 @@ let users = [
368
368
  { 'user': 'pebbles', 'active': false }
369
369
  ]
370
370
 
371
- findLastIndex(users, (o) => o.user == 'pebbles')
371
+ findLastIndex(users, o => o.user == 'pebbles')
372
372
  // 2
373
373
 
374
374
  // The `shape` iteratee shorthand.
@@ -409,27 +409,9 @@ export declare function lastIndexOf<T>(obj: T[], value: T, start?: number): numb
409
409
  * @param {*} value
410
410
  * @param {boolean} [deep=false]
411
411
  * @return The clone value
412
- * @see {@link cloneArray}
413
- * @see {@link cloneTypedArray}
414
412
  */
415
413
  export declare function clone<T>(value: T, deep?: boolean): T;
416
414
  export declare function clone<T>(value: T[], deep?: boolean): T[];
417
- /**
418
- * Clones an array. If `deep` is `false` (default) the clone will be shallow. Otherwise {@link https://developer.mozilla.org/en-US/docs/Web/API/structuredClone structuredClone} is used.
419
- * @param arr The array to clone
420
- * @param [deep=false] Creates a deep clone using `structuredClone` if true.
421
- * @returns The new array
422
- * @see {@link clone}
423
- */
424
- export declare function cloneArray<T>(arr: T[], deep?: boolean): T[];
425
- /**
426
- * Clones a typed array. If `deep` is `false` (default) the clone will be shallow. Otherwise {@link https://developer.mozilla.org/en-US/docs/Web/API/structuredClone structuredClone} is used.
427
- * @param arr The array to clone
428
- * @param [deep=false] Creates a deep clone using `structuredClone` if true.
429
- * @returns The new array
430
- * @see {@link clone}
431
- */
432
- export declare function cloneTypedArray(typedArray: any, isDeep?: boolean): any;
433
415
  /**
434
416
  * Creates a duplicate-free version of an array, using a `Set` for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is not guaranteed.
435
417
  * @param arr The array containing duplicated elements
@@ -455,7 +437,7 @@ export declare function uniq<T>(arr: Iterable<T>, fn?: PropertyKey): T[];
455
437
  * @returns Returns the new duplicate free array
456
438
  * @example
457
439
  ```js
458
- uniq([2, 1, 2])
440
+ sortedUniq([2, 1, 2])
459
441
  // [1, 2]
460
442
  ```
461
443
  * @see {@link uniq}
@@ -463,7 +445,7 @@ uniq([2, 1, 2])
463
445
  export declare function sortedUniq<T>(arr: Iterable<T>, fn?: Iteratee<T>): T[];
464
446
  export declare function sortedUniq<T>(arr: Iterable<T>, fn?: PropertyKey): T[];
465
447
  /**
466
- * 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.
448
+ * Recursively merges own 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.
467
449
  *
468
450
  * Note: this method mutates `object`
469
451
  *
@@ -512,7 +494,7 @@ export declare function defaults(object: Object, ...sources: Object[]): Object;
512
494
  * @see {@link union}
513
495
  * @see {@link intersection}
514
496
  */
515
- export declare function difference<T>(...args: Array<Iterable<T>>): Generator<T, void, unknown>;
497
+ export declare function difference<T>(...args: Array<Iterable<T>>): Generator<T>;
516
498
  /**
517
499
  * Creates a generator of unique values that are included in all given arrays.
518
500
  * @param args The arrays to inspect
@@ -524,7 +506,7 @@ export declare function difference<T>(...args: Array<Iterable<T>>): Generator<T,
524
506
  * @see {@link difference}
525
507
  * @see {@link union}
526
508
  */
527
- export declare function intersection<T>(...args: Array<Iterable<T>>): Generator<T, void, unknown>;
509
+ export declare function intersection<T>(...args: Array<Iterable<T>>): Generator<T>;
528
510
  /**
529
511
  * Creates a generator of unique values from all given arrays using `Set` for equality comparisons.
530
512
  * @param args The arrays to perform union on.
@@ -536,12 +518,12 @@ export declare function intersection<T>(...args: Array<Iterable<T>>): Generator<
536
518
  * @see {@link difference}
537
519
  * @see {@link intersection}
538
520
  */
539
- export declare function union<T>(...args: Array<Iterable<T>>): Generator<T, void, unknown>;
521
+ export declare function union<T>(...args: Array<Iterable<T>>): Generator<T>;
540
522
  /**
541
523
  * 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.
542
524
  *
543
525
  * @param arr The collection to iterate over.
544
- * @param [func=id] The iteratee to transform keys.
526
+ * @param [func=identity] The iteratee to transform keys.
545
527
  * @returns Returns the aggregated object.
546
528
  *
547
529
  * @example
@@ -562,14 +544,14 @@ export declare function groupBy<T>(arr: Object, fn: PropertyKey): Record<Propert
562
544
  * Similar to {@link groupBy} but it returns a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map Map} object with the results.
563
545
  *
564
546
  * @param arr The collection to iterate over.
565
- * @param {Function | PropertyKey} [func=id] The iteratee to transform keys.
547
+ * @param {Function | PropertyKey} [func=identity] The iteratee to transform keys.
566
548
  * @returns {Map} Returns the aggregated map object.
567
549
  * @template K, V
568
550
  *
569
551
  * @example
570
552
  ```js
571
553
  groupByMap([6.1, 4.2, 6.3], Math.floor)
572
- // Map { 4: [4.2], 6: [6.1, 6.3] }
554
+ // Map { 6: [6.1, 6.3], 4: [4.2] }
573
555
 
574
556
  // The `property` iteratee shorthand.
575
557
  groupByMap(['one', 'two', 'three'], 'length')
@@ -591,8 +573,8 @@ export declare function remove<T>(arr: T[], func: T[]): T[];
591
573
  export declare function remove<T>(arr: T[], func: Iteratee<T>): T[];
592
574
  /**
593
575
  * Returns the index of `x` in a **sorted** array if found, in `O(log n)` using binary search.
594
- * If the element is not found, returns a negative integer.
595
- * @param arr The array to sort
576
+ * If the element is not found, returns `-n - 1`, where `n` is the index to insert `x` at.
577
+ * @param arr The sorted array
596
578
  * @param x The element to find
597
579
  * @param lo The starting index
598
580
  * @param hi The end index to search within
@@ -602,7 +584,7 @@ export declare function remove<T>(arr: T[], func: Iteratee<T>): T[];
602
584
  export declare function binarySearch(arr: any[], x: any, lo?: number, hi?: any, comp?: typeof compare): number;
603
585
  /**
604
586
  * Returns an insertion index which comes after any existing entries of `x` in a **sorted** array, using binary search.
605
- * @param arr The array to sort
587
+ * @param arr The sorted array
606
588
  * @param x The element to find
607
589
  * @param lo The starting index
608
590
  * @param hi The end index to search within
@@ -612,7 +594,7 @@ export declare function binarySearch(arr: any[], x: any, lo?: number, hi?: any,
612
594
  export declare function bisect(arr: any[], x: any, lo?: number, hi?: any, comp?: typeof compare): number;
613
595
  /**
614
596
  * Returns an insertion index which comes before any existing entries of `x` in a **sorted** array, using binary search.
615
- * @param arr The array to sort
597
+ * @param arr The sorted array
616
598
  * @param x The element to find
617
599
  * @param lo The starting index
618
600
  * @param hi The end index to search within