Skip to content

Commit 0ce7ad2

Browse files
authored
Address tsdoc warnings from API extractor
1 parent 38085ce commit 0ce7ad2

File tree

2 files changed

+68
-67
lines changed

2 files changed

+68
-67
lines changed

src/MultiRange.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class MultiRange {
4343

4444
/**
4545
* Appends to this instance.
46-
* @param value The data to append.
46+
* @param value - The data to append.
4747
*/
4848
public append(value: Initializer): MultiRange {
4949
this.ranges = mr.append(
@@ -55,7 +55,7 @@ export class MultiRange {
5555

5656
/**
5757
* Subtracts from this instance.
58-
* @param value The data to subtract.
58+
* @param value - The data to subtract.
5959
*/
6060
public subtract(value: Initializer): MultiRange {
6161
this.ranges = mr.subtract(
@@ -68,7 +68,7 @@ export class MultiRange {
6868
/**
6969
* Remove integers which are not included in `value`,
7070
* yielding the intersection of this and `value`.
71-
* @param value The data to calculate the intersetion.
71+
* @param value - The data to calculate the intersetion.
7272
*/
7373
public intersect(value: Initializer): MultiRange {
7474
this.ranges = mr.intersect(
@@ -90,7 +90,7 @@ export class MultiRange {
9090

9191
/**
9292
* Checks if this instance contains the specified value.
93-
* @param value Value to be checked.
93+
* @param value - Value to be checked.
9494
* @returns True if the specified value is included in the instance.
9595
*/
9696
public has(value: Initializer): boolean {
@@ -119,7 +119,7 @@ export class MultiRange {
119119

120120
/**
121121
* Checks if two instances of MultiRange are identical.
122-
* @param cmp The data to compare.
122+
* @param cmp - The data to compare.
123123
* @returns True if `cmp` is exactly the same as this instance.
124124
*/
125125
public equals(cmp: Initializer): boolean {

src/fp.ts

Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ export type Options = {
2626
* Parses a string and creates a new MultiIntegerRange array.
2727
* This is the default parser, but you can create and use another parser
2828
* to suit your needs as long as it produces a normalized array of `Range`s.
29-
* @param data The string to parse.
30-
* @param options Options to modify the parsing behavior.
29+
* @param data - The string to parse.
30+
* @param options - Options to modify the parsing behavior.
3131
* @returns A new normalized MultiIntegerRange.
3232
* @example
33-
* parse('1-10'); //=> [[1, 10]]
34-
* parse(' 10-, 7', { parseUnbounded: true }); //=> [[7, 7], [10, Infinity]]
33+
* parse('1-10'); // [[1, 10]]
34+
* parse(' 10-, 7', \{ parseUnbounded: true \}); // [[7, 7], [10, Infinity]]
3535
*/
3636
export const parse = (data: string, options?: Options): MIR => {
3737
const { parseNegative = false, parseUnbounded = false } = options || {};
@@ -78,13 +78,13 @@ export const parse = (data: string, options?: Options): MIR => {
7878
/**
7979
* Takes a number or an unsorted array of ranges,
8080
* and returns a new normalized MultiIntegerRange.
81-
* @param data A number or an unsorted array, e.g., `[[7, 5], 1]`.
81+
* @param data - A number or an unsorted array, e.g., `[[7, 5], 1]`.
8282
* @returns Normalized array, e.g., `[[1, 1], [5, 7]]`.
8383
* @example
84-
* normalize(5); //=> [[5, 5]]
85-
* normalize([1, 8]) //=> [[1, 1], [8, 8]]
86-
* normalize([[1, 8]]) //=> [[1, 8]]
87-
* normalize([[1, Infinity]]) //=> [[1, Infinity]]
84+
* normalize(5); // [[5, 5]]
85+
* normalize([1, 8]) // [[1, 1], [8, 8]]
86+
* normalize([[1, 8]]) // [[1, 8]]
87+
* normalize([[1, Infinity]]) // [[1, Infinity]]
8888
*/
8989
export const normalize = (data?: (number | Range)[] | number): MIR => {
9090
const result: Range[] = [];
@@ -116,13 +116,13 @@ export const normalize = (data?: (number | Range)[] | number): MIR => {
116116
/**
117117
* Takes any supported data and returns a normalized MultiIntegerRange.
118118
* Conditionally calls either `parse` or `normalize` under the hood.
119-
* This is an equivalent of "initializer" constructor of version <= 4.
120-
* @param data Anything understood by either `parse` or `normalize`.
121-
* @param options Parse options passed to `parse`.
119+
* This is an equivalent of "initializer" constructor of version &le; 4.
120+
* @param data - Anything understood by either `parse` or `normalize`.
121+
* @param options - Parse options passed to `parse`.
122122
* @returns A new normalized MultiIntegerRange.
123123
* @example
124-
* initialize(5); //=> [[5, 5]]
125-
* initialize('2-8'); //=> [[2,8]]
124+
* initialize(5); // [[5, 5]]
125+
* initialize('2-8'); // [[2,8]]
126126
*/
127127
export const initialize = (
128128
data?: (number | Range)[] | number | string,
@@ -133,8 +133,8 @@ export const initialize = (
133133

134134
/**
135135
* Calculates the union of two specified ranges.
136-
* @param a Range A.
137-
* @param b Range B.
136+
* @param a - Range A.
137+
* @param b - Range B.
138138
* @private
139139
* @returns Union of `a` and `b`.
140140
* Returns `null` if `a` and `b` do not touch nor intersect.
@@ -150,7 +150,8 @@ const calcUnion = (a: Range, b: Range): Range | null => {
150150
* Determines how the given range overlaps or touches the existing ranges.
151151
* This is a helper method that calculates how an append/subtract operation
152152
* affects the existing range members.
153-
* @param target The range array to test.
153+
* @private
154+
* @param target - The range array to test.
154155
* @returns An object containing information about how the given range
155156
* overlaps or touches this instance.
156157
*/
@@ -223,11 +224,11 @@ const findOverlap = (
223224

224225
/**
225226
* Appends two MultiIntegerRange's.
226-
* @param a The first value.
227-
* @param b The second value.
227+
* @param a - The first value.
228+
* @param b - The second value.
228229
* @example
229-
* append([[1, 5]], [[3, 8], [10, 15]]); //=> 1-8,10-15
230-
* append([[5, Infinity]], [[-Infinity, 2]]); //=> -2,5-
230+
* append([[1, 5]], [[3, 8], [10, 15]]); // [[1, 8], [10, 15]]
231+
* append([[5, 9]], [[-Infinity, 2]]); // [[-Infinity, 2], [5, 9]]
231232
*/
232233
export const append = (a: MIR, b: MIR): MIR => {
233234
let result = a.slice(0);
@@ -240,11 +241,11 @@ export const append = (a: MIR, b: MIR): MIR => {
240241

241242
/**
242243
* Subtracts the second value from the first value.
243-
* @param a The value to be subtracted.
244-
* @param b The value to subtract.
244+
* @param a - The value to be subtracted.
245+
* @param b - The value to subtract.
245246
* @example
246-
* subtract([[1, 7]], [[2, 4]]); //=> 1,5-7
247-
* subtract([[-Infinity, Infinity]], [[2, 4]]); //=> -1,5-
247+
* subtract([[1, 7]], [[2, 4]]); // [[1, 1], [5, 7]]
248+
* subtract([[-Infinity, Infinity]], [[2, 4]]); // [[-Infinity, 1], [5, Infinity]]
248249
*/
249250
export const subtract = (a: MIR, b: MIR): MIR => {
250251
let result = a.slice(0);
@@ -266,13 +267,13 @@ export const subtract = (a: MIR, b: MIR): MIR => {
266267

267268
/**
268269
* Calculates the intersection (common integers) of the two MultiIntegerRange's.
269-
* @param a The first value.
270-
* @param b The second value.
270+
* @param a - The first value.
271+
* @param b - The second value.
271272
* @returns A new MultiIntegerRange containing all integers
272273
* that belong to both `a` and `b`.
273274
* @example
274-
* intersect([[2, 5]], [[4, 9]]); //=> 4-5
275-
* intersect([[5, 10]], [[-Infinity, Infinity]]); //=> 5-10
275+
* intersect([[2, 5]], [[4, 9]]); // [[4, 5]]
276+
* intersect([[5, 10]], [[-Infinity, Infinity]]); // [[5, 10]]
276277
*/
277278
export const intersect = (a: MIR, b: MIR): MIR => {
278279
const result: Range[] = [];
@@ -296,12 +297,12 @@ export const intersect = (a: MIR, b: MIR): MIR => {
296297

297298
/**
298299
* Checks if `a` contains or is equal to `b` (a ⊇ b).
299-
* @param a The value that possibly contains `b`.
300-
* @param b The value that is possibly contained by `a`.
300+
* @param a - The value that possibly contains `b`.
301+
* @param b - The value that is possibly contained by `a`.
301302
* @returns True if `b` is a subset of `a`.
302303
* @example
303-
* has([[0, 100]], [[2, 10]]) //=> true
304-
* has([[2, 10]], [[0, 100]]) //=> false
304+
* has([[0, 100]], [[2, 10]]) // true
305+
* has([[2, 10]], [[0, 100]]) // false
305306
*/
306307
export const has = (a: MIR, b: MIR): boolean => {
307308
const s = 0;
@@ -320,11 +321,11 @@ export const has = (a: MIR, b: MIR): boolean => {
320321

321322
/**
322323
* Calculates how many integers are included in the given MultiIntegerRange.
323-
* @param data The value to calculate the length on.
324+
* @param data - The value to calculate the length on.
324325
* @returns The number of integers contained in `data`. May be `Infinity`.
325326
* @example
326-
* length([[1, 3], [8, 10]]); //=> 6
327-
* length([[1, Infinity]]); //=> Infinity
327+
* length([[1, 3], [8, 10]]); // 6
328+
* length([[1, Infinity]]); // Infinity
328329
*/
329330
export const length = (data: MIR): number => {
330331
if (isUnbounded(data)) return Infinity;
@@ -335,12 +336,12 @@ export const length = (data: MIR): number => {
335336

336337
/**
337338
* Checks if the data contains an unbounded (aka inifinite) range.
338-
* @param data The value to check.
339+
* @param data - The value to check.
339340
* @returns True if `data` is unbounded.
340341
* @example
341-
* isUnbounded([[1, Infinity]]); //=> true
342-
* isUnbounded([[-Infinity, 4]]); //=> true
343-
* isUnbounded([[7, 9]]); //=> false
342+
* isUnbounded([[1, Infinity]]); // true
343+
* isUnbounded([[-Infinity, 4]]); // true
344+
* isUnbounded([[7, 9]]); // false
344345
*/
345346
export const isUnbounded = (data: MIR): boolean => {
346347
return (
@@ -351,12 +352,12 @@ export const isUnbounded = (data: MIR): boolean => {
351352

352353
/**
353354
* Checks if the two values are the same.
354-
* @param a The first value to compare.
355-
* @param b The second value to compare.
355+
* @param a - The first value to compare.
356+
* @param b - The second value to compare.
356357
* @returns True if `a` and `b` have the same range data.
357358
* @example
358-
* equals([[1, 5], [7, 8]], [[1, 5], [7, 8]]); //=> true
359-
* equals([[1, 5]], [[2, 7]]); //=> false
359+
* equals([[1, 5], [7, 8]], [[1, 5], [7, 8]]); // true
360+
* equals([[1, 5]], [[2, 7]]); // false
360361
*/
361362
export const equals = (a: MIR, b: MIR): boolean => {
362363
if (a === b) return true;
@@ -369,12 +370,12 @@ export const equals = (a: MIR, b: MIR): boolean => {
369370

370371
/**
371372
* Returns the minimum integer of the given MultiIntegerRange.
372-
* @param data The value.
373+
* @param data - The value.
373374
* @returns The minimum integer. May be `undefined` of `-Infinity`.
374375
* @example
375-
* min([[2, 5], [8, 10]]); //=> 2
376-
* min([[-Infinity, 0]]); //=> -Infinity
377-
* min([]); //=> undefined
376+
* min([[2, 5], [8, 10]]); // 2
377+
* min([[-Infinity, 0]]); // -Infinity
378+
* min([]); // undefined
378379
*/
379380
export const min = (data: MIR): number | undefined => {
380381
if (data.length === 0) return undefined;
@@ -383,12 +384,12 @@ export const min = (data: MIR): number | undefined => {
383384

384385
/**
385386
* Returns the maximum integer of the given MultiIntegerRange.
386-
* @param data The value.
387+
* @param data - The value.
387388
* @returns The minimum integer. May be `undefined` of `Infinity`.
388389
* @example
389-
* max([[2, 5], [8, 10]]); //=> 10
390-
* max([[3, Infinity]]); //=> Infinity
391-
* max([]); //=> undefined
390+
* max([[2, 5], [8, 10]]); // 10
391+
* max([[3, Infinity]]); // Infinity
392+
* max([]); // undefined
392393
*/
393394
export const max = (data: MIR): number | undefined => {
394395
if (data.length === 0) return undefined;
@@ -397,11 +398,11 @@ export const max = (data: MIR): number | undefined => {
397398

398399
/**
399400
* Returns all but the minimum integer.
400-
* @param data The value.
401+
* @param data - The value.
401402
* @returns A new MultiIntegerRange which is almost the same as `data` but with
402403
* its minimum integer removed.
403404
* @example
404-
* tail([[2, 5], [8, 10]]); //=> 3-5,8-10
405+
* tail([[2, 5], [8, 10]]); // [[3, 5], [8, 10]]
405406
*/
406407
export const tail = (data: MIR): MIR => {
407408
const m = min(data);
@@ -415,11 +416,11 @@ export const tail = (data: MIR): MIR => {
415416

416417
/**
417418
* Returns all but the maximum integer.
418-
* @param data The value.
419+
* @param data - The value.
419420
* @returns A new MultiIntegerRange which is almost the same as `data` but with
420421
* its maximum integer removed.
421422
* @example
422-
* init([[2, 5], [8, 10]]); //=> 2-5,8-9
423+
* init([[2, 5], [8, 10]]); // [[2, 5], [8, 9]]
423424
*/
424425
export const init = (data: MIR): MIR => {
425426
const m = max(data);
@@ -433,9 +434,9 @@ export const init = (data: MIR): MIR => {
433434

434435
/**
435436
* Returns the string respresentation of the given MultiIntegerRange.
436-
* @param data The value to stringify.
437+
* @param data - The value to stringify.
437438
* @example
438-
* stringify([[3, 5], [7, Infinity]]); //=> '3-5,7-'
439+
* stringify([[3, 5], [7, Infinity]]); // '3-5,7-'
439440
*/
440441
export const stringify = (data: MIR): string => {
441442
const wrap = (i: number) => (i >= 0 ? String(i) : `(${i})`);
@@ -462,9 +463,9 @@ export const stringify = (data: MIR): string => {
462463
* Builds a flattened array of integers.
463464
* Note that this may be slow and memory-consuming for large ranges.
464465
* Consider using the iterator whenever possible.
465-
* @param data The value to build an array on.
466+
* @param data - The value to build an array on.
466467
* @example
467-
* flatten([[-1, 1], [7, 9]]); //=> [-1, 0, 1, 7, 8, 9]
468+
* flatten([[-1, 1], [7, 9]]); // [-1, 0, 1, 7, 8, 9]
468469
*/
469470
export const flatten = (data: MIR): number[] => {
470471
if (isUnbounded(data)) {
@@ -482,10 +483,10 @@ export const flatten = (data: MIR): number[] => {
482483

483484
/**
484485
* Returns an Iterable with which you can use `for-of` or the spread syntax.
485-
* @param data The normalized MultiIntegerRange to iterate over.
486+
* @param data - The normalized MultiIntegerRange to iterate over.
486487
* @returns An Iterable object.
487488
* @example
488-
* Array.from(iterate([[1, 3], [7, 9]])); //=> [1, 2, 3, 7, 8, 9]
489+
* Array.from(iterate([[1, 3], [7, 9]])); // [1, 2, 3, 7, 8, 9]
489490
*/
490491
export const iterate = (data: MIR): Iterable<number> => {
491492
if (isUnbounded(data)) {

0 commit comments

Comments
 (0)