diff --git a/packages/realm/src/OrderedCollection.ts b/packages/realm/src/OrderedCollection.ts index 22d957a30c..9e5754bdd7 100644 --- a/packages/realm/src/OrderedCollection.ts +++ b/packages/realm/src/OrderedCollection.ts @@ -110,7 +110,7 @@ const PROXY_HANDLER: ProxyHandler = { * that can be stored as properties of Realm objects. It can be * accessed in any of the ways that a normal JavaScript Array can, including * subscripting, enumerating with `for-of` and so on. - * @see (https://mdn.io/Array) + * @see {@link https://mdn.io/Array | Array} */ export abstract class OrderedCollection extends Collection> @@ -225,7 +225,7 @@ export abstract class OrderedCollection[]): T[]; /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat Array.prototype.concat} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat | Array.prototype.concat()} * @param items - Arrays and/or values to concatenate into a new array. * @returns A new array with the results of calling a provided function on every element in this array. */ @@ -325,7 +325,7 @@ export abstract class OrderedCollection( predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any, ): this is readonly S[]; /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every Array.prototype.every} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every | Array.prototype.every()} * @params predicate - A function to test for each element. * @params predicate.value - The current element being processed in the collection. * @params predicate.index - The index of the current element being processed in the collection. - * @params predicate.array - The collection every was called upon. - * @params thisArg - An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - * @returns true if the callback function returns a truthy value for every collection element; otherwise, false. + * @params predicate.array - The collection `every` was called upon. + * @params thisArg - An object to which the `this` keyword can refer in the predicate function. If `thisArg` is omitted, `undefined` is used as the `this` value. + * @returns `true` if the callback function returns a truthy value for every collection element; otherwise, `false`. */ every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; every(predicate: any, thisArg?: any): boolean { return [...this].every(predicate, thisArg); } /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some Array.prototype.some} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some | Array.prototype.some()} * @params predicate - A function to test for each element. * @params predicate.value - The current element being processed in the collection. * @params predicate.index - The index of the current element being processed in the collection. - * @params predicate.array - The collection every was called upon. - * @params thisArg - An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - * @returns true if the callback function returns a truthy value for any collection element; otherwise, false. + * @params predicate.array - The collection `every` was called upon. + * @params thisArg - An object to which the `this` keyword can refer in the predicate function. If `thisArg` is omitted, `undefined` is used as the `this` value. + * @returns `true` if the callback function returns a truthy value for any collection element; otherwise, `false`. */ some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean { return [...this].some(predicate, thisArg); } /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach Array.prototype.forEach} - * @params callbackfn - A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the collection. + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach | Array.prototype.forEach()} + * @params callbackfn - A function that accepts up to three arguments. `forEach` calls the callbackfn function one time for each element in the collection. * @params callbackfn.value - The current element being processed in the collection. * @params callbackfn.index - The index of the current element being processed in the collection. - * @params callbackfn.array - The collection forEach was called upon. - * @params thisArg - An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + * @params callbackfn.array - The collection `forEach` was called upon. + * @params thisArg - An object to which the `this` keyword can refer in the `callbackfn` function. If `thisArg` is omitted, `undefined` is used as the `this` value. */ forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void { return [...this].forEach(callbackfn, thisArg); } /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map Array.prototype.map} - * @params callbackfn - A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the collection. + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.prototype.map()} + * @params callbackfn - A function that accepts up to three arguments. The `map` method calls the `callbackfn` function one time for each element in the collection. * @params callbackfn.value - The current element being processed in the collection. * @params callbackfn.index - The index of the current element being processed in the collection. - * @params callbackfn.array - The collection map was called upon. - * @params thisArg - An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - * @returns A new array containing the results of calling the callbackfn function on each element in the collection. + * @params callbackfn.array - The collection `map` was called upon. + * @params thisArg - An object to which the `this` keyword can refer in the `callbackfn` function. If `thisArg` is omitted, `undefined` is used as the `this` value. + * @returns A new array containing the results of calling the `callbackfn` function on each element in the collection. */ map(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[] { return [...this].map(callbackfn, thisArg); } /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter Array.prototype.filter} - * @params predicate - A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the collection. + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter | Array.prototype.filter()} + * @params predicate - A function that accepts up to three arguments. The `filter` method calls the `predicate` function one time for each element in the collection. * @params predicate.value - The current element being processed in the collection. * @params predicate.index - The index of the current element being processed in the collection. - * @params predicate.array - The collection filter was called upon. - * @params thisArg - An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - * @returns A new array containing the elements of the collection for which the callbackfn function returned true. + * @params predicate.array - The collection `filter` was called upon. + * @params thisArg - An object to which the `this` keyword can refer in the `predicate` function. If `thisArg` is omitted, `undefined` is used as the `this` value. + * @returns A new array containing the elements of the collection for which the `predicate` function returned `true`. */ filter(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[]; /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter Array.prototype.filter} - * @params predicate - A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the collection. + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter | Array.prototype.filter()} + * @params predicate - A function that accepts up to three arguments. The `filter` method calls the `predicate` function one time for each element in the collection. * @params predicate.value - The current element being processed in the collection. * @params predicate.index - The index of the current element being processed in the collection. - * @params predicate.array - The collection filter was called upon. - * @params thisArg - An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - * @returns A new array containing the elements of the collection for which the callbackfn function returned true. + * @params predicate.array - The collection `filter` was called upon. + * @params thisArg - An object to which the `this` keyword can refer in the `predicate` function. If `thisArg` is omitted, `undefined` is used as the `this` value. + * @returns A new array containing the elements of the collection for which the `predicate` function returned `true`. */ filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[]; filter(predicate: any, thisArg?: any): T[] | S[] { return [...this].filter(predicate, thisArg); } /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce Array.prototype.reduce} - * @params callbackfn - A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the collection. - * @params callbackfn.previousValue - The value previously returned in the last invocation of the callbackfn function, or initialValue, if supplied. (See below.) + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce | Array.prototype.reduce()} + * @params callbackfn - A function that accepts up to four arguments. The `reduce` method calls the `callbackfn` function one time for each element in the collection. + * @params callbackfn.previousValue - The value previously returned in the last invocation of the `callbackfn` function, or `initialValue`, if supplied. (See below.) * @params callbackfn.currentValue - The current element being processed in the collection. * @params callbackfn.currentIndex - The index of the current element being processed in the collection. - * @params callbackfn.array - The collection reduceRight was called upon. - * @params initialValue - If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an element value. + * @params callbackfn.array - The collection `reduce` was called upon. + * @params initialValue - If `initialValue` is specified, it is used as the initial value to start the accumulation. The first call to the `callbackfn` function provides this value as an argument instead of an element value. * @returns The value that results from the reduction. */ reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce Array.prototype.reduce} - * @params callbackfn - A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the collection. - * @params callbackfn.previousValue - The value previously returned in the last invocation of the callbackfn function, or initialValue, if supplied. (See below.) + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce | Array.prototype.reduce()} + * @params callbackfn - A function that accepts up to four arguments. The `reduce` method calls the `callbackfn` function one time for each element in the collection. + * @params callbackfn.previousValue - The value previously returned in the last invocation of the `callbackfn` function, or `initialValue`, if supplied. (See below.) * @params callbackfn.currentValue - The current element being processed in the collection. * @params callbackfn.currentIndex - The index of the current element being processed in the collection. - * @params callbackfn.array - The collection reduceRight was called upon. - * @params initialValue - If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an element value. + * @params callbackfn.array - The collection `reduce` was called upon. + * @params initialValue - If `initialValue` is specified, it is used as the initial value to start the accumulation. The first call to the `callbackfn` function provides this value as an argument instead of an element value. * @returns The value that results from the reduction. */ reduce( @@ -475,13 +475,13 @@ export abstract class OrderedCollection( @@ -492,24 +492,24 @@ export abstract class OrderedCollection T): T; /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight Array.prototype.reduceRight} - * @params callbackfn - A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the collection. - * @params callbackfn.previousValue - The value previously returned in the last invocation of the callbackfn function, or initialValue, if supplied. (See below.) + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight | Array.prototype.reduceRight()} + * @params callbackfn - A function that accepts up to four arguments. The `reduceRight` method calls the `callbackfn` function one time for each element in the collection. + * @params callbackfn.previousValue - The value previously returned in the last invocation of the `callbackfn` function, or `initialValue`, if supplied. (See below.) * @params callbackfn.currentValue - The current element being processed in the collection. * @params callbackfn.currentIndex - The index of the current element being processed in the collection. - * @params callbackfn.array - The collection reduceRight was called upon. - * @params initialValue - If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an element value. + * @params callbackfn.array - The collection `reduceRight` was called upon. + * @params initialValue - If `initialValue` is specified, it is used as the initial value to start the accumulation. The first call to the `callbackfn` function provides this value as an argument instead of an element value. * @returns The value that results from the reduction. */ reduceRight( @@ -517,13 +517,13 @@ export abstract class OrderedCollection( @@ -535,35 +535,35 @@ export abstract class OrderedCollection( predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any, ): S | undefined; /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find Array.prototype.find} - * @params predicate - A function that accepts up to three arguments. The find method calls the predicate function one time for each element in the collection. + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find | Array.prototype.find()} + * @params predicate - A function that accepts up to three arguments. The `find` method calls the `predicate` function one time for each element in the collection. * @params predicate.value - The value of the element. * @params predicate.index - The index of the element. * @params predicate.obj - The object being traversed. - * @params thisArg - An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - * @returns The value of the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned. + * @params thisArg - An object to which the `this` keyword can refer in the `predicate` function. If `thisArg` is omitted, `undefined` is used as the `this` value. + * @returns The value of the first element in the array that satisfies the provided testing function. Otherwise, `undefined` is returned. */ find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined; find(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T | undefined { return [...this].find(predicate, thisArg); } /** - * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex Array.prototype.findIndex} - * @params predicate - A function that accepts up to three arguments. The findIndex method calls the predicate function one time for each element in the collection. - * @params thisArg - An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex | Array.prototype.findIndex()} + * @params predicate - A function that accepts up to three arguments. The `findIndex` method calls the `predicate` function one time for each element in the collection. + * @params thisArg - An object to which the `this` keyword can refer in the `predicate` function. If `thisArg` is omitted, `undefined` is used as the `this` value. * @returns The index of the first element in the array that satisfies the provided testing function. Otherwise, -1 is returned. */ findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number { @@ -580,11 +580,11 @@ export abstract class OrderedCollection