Skip to content

Commit

Permalink
docs: #362 update/fix doc string links between pkgs & functions
Browse files Browse the repository at this point in the history
- update all inter-package links as normal Markdown links to docs.thi.ng
- remove `{@link}` from plain URLs (wikipedia etc.)
- manually fix all `{@link}` with labels or to overrides
- manually reformat/rewrap doc strings
  • Loading branch information
postspectacular committed Dec 16, 2022
1 parent b831a00 commit e549222
Show file tree
Hide file tree
Showing 253 changed files with 1,788 additions and 1,672 deletions.
7 changes: 4 additions & 3 deletions packages/adjacency/src/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ export class AdjacencyBitMatrix implements IGraph<number> {
}

/**
* Creates adjacency matrix backed by a {@link @thi.ng/bitfield#BitMatrix}
* Creates adjacency matrix backed by a
* [`BitMatrix`](https://docs.thi.ng/umbrella/bitfield/classes/BitMatrix.html)
* with capacity `n` (max vertices), optionally initialized with given edge
* pairs. Each edge is `[src-node dest-node]`. If `undirected` is true
* (default: false), creates symmetrical adjacencies.
* pairs. Each edge is `[src-node dest-node]`. If `undirected` is true (default:
* false), creates symmetrical adjacencies.
*
* @param n - max vertices
* @param edges - edge pairs
Expand Down
8 changes: 4 additions & 4 deletions packages/adjacency/src/disjoint-set.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { fillRange } from "@thi.ng/arrays/fill-range";

/**
* Typed array based Disjoint Set implementation with quick union and
* path compression, after Sedgewick & Wayne.
* Typed array based Disjoint Set implementation with quick union and path
* compression, after Sedgewick & Wayne.
*
* @remarks
* - {@link https://en.wikipedia.org/wiki/Disjoint-set_data_structure}
* - {@link https://algs4.cs.princeton.edu/lectures/15UnionFind-2x2.pdf}
* - https://en.wikipedia.org/wiki/Disjoint-set_data_structure
* - https://algs4.cs.princeton.edu/lectures/15UnionFind-2x2.pdf
*/
export class DisjointSet {
roots: Uint32Array;
Expand Down
6 changes: 4 additions & 2 deletions packages/adjacency/src/mst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import { DisjointSet } from "./disjoint-set.js";
* criteria. The result edges will be in ascending order, based on the supplied
* cost function. The cost function is called once for each edge and return
* values will be cached prior to sorting (see
* {@link @thi.ng/arrays#sortByCachedKey} for details).
* [`sortByCachedKey()`](https://docs.thi.ng/umbrella/arrays/functions/sortByCachedKey.html)
* for details).
*
* Reference: {@link https://en.wikipedia.org/wiki/Kruskal%27s_algorithm}
* References:
* - https://en.wikipedia.org/wiki/Kruskal%27s_algorithm
*
* @example
* ```ts
Expand Down
21 changes: 12 additions & 9 deletions packages/adjacency/src/sparse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export class AdjacencyMatrix extends CSR implements IGraph<number> {
}

/**
* Returns a diagonal sparse matrix {@link @thi.ng/sparse#CSR} containing
* Returns a diagonal sparse matrix
* [`CSR`](https://docs.thi.ng/umbrella/sparse/classes/CSR.html) containing
* information about the degree of each vertex, i.e. the number of edges
* attached to each vertex.
*
Expand Down Expand Up @@ -115,12 +116,13 @@ export class AdjacencyMatrix extends CSR implements IGraph<number> {
}

/**
* Returns this graph's Laplacian matrix: `L = D - A` Where `D` is
* the degree matrix and `A` this adjacency matrix.
* Returns this graph's Laplacian matrix: `L = D - A` Where `D` is the
* degree matrix and `A` this adjacency matrix.
*
* @remarks
* - {@link https://en.wikipedia.org/wiki/Laplacian_matrix}
* - {@link https://en.wikipedia.org/wiki/Discrete_Laplace_operator}
* References:
* - https://en.wikipedia.org/wiki/Laplacian_matrix
* - https://en.wikipedia.org/wiki/Discrete_Laplace_operator
*
* @param deg - degree type for {@link AdjacencyMatrix.degreeMat}
*/
Expand Down Expand Up @@ -173,10 +175,11 @@ export class AdjacencyMatrix extends CSR implements IGraph<number> {
}

/**
* Creates an adjacency matrix backed by a sparse {@link @thi.ng/sparse#CSR}
* matrix, optionally initialize with given edge pairs. Each edge is a `[src,
* dest]` tuple. If `undirected` is true (default: false), creates symmetrical
* edges (i.e. undirected graph).
* Creates an adjacency matrix backed by a sparse
* [`CSR`](https://docs.thi.ng/umbrella/sparse/classes/CSR.html) matrix,
* optionally initialize with given edge pairs. Each edge is a `[src, dest]`
* tuple. If `undirected` is true (default: false), creates symmetrical edges
* (i.e. undirected graph).
*
* @param n - max number of vertices
* @param edges - edge pairs
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/hiccup.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export interface IToHiccup {
/**
* Returns a {@link @thi.ng/hiccup# | @thi.ng/hiccup} compatible representation. The optional
* `ctx` arg is an arbitrary user context object passed to all
* hiccup components during serialization (or during DOM creation /
* update if used with {@link @thi.ng/hdom# | @thi.ng/hdom})
* Returns a [thi.ng/hiccup](https://thi.ng/hiccup) compatible
* representation. The optional `ctx` arg is an arbitrary user context
* object passed to all hiccup components during serialization (or during
* DOM creation / update if used with [thi.ng/hdom](https://thi.ng/hdom)).
*
* @param ctx - user context object
* @param attribs - user attribs
Expand Down
8 changes: 5 additions & 3 deletions packages/api/src/mixin.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/**
* Class behavior mixin based on:
* {@link http://raganwald.com/2015/06/26/decorators-in-es7.html}
* - http://raganwald.com/2015/06/26/decorators-in-es7.html
*
* Additionally only injects/overwrites properties in target, which are NOT
* marked with `@nomixin` (i.e. those which haven't set their `configurable`
* property descriptor flag to `false`)
* marked with
* [`@nomixin`](https://docs.thi.ng/umbrella/api/functions/nomixin.html) (i.e.
* those which haven't set their `configurable` property descriptor flag to
* `false`)
*
* @param behaviour - to mixin
* @param sharedBehaviour -
Expand Down
9 changes: 4 additions & 5 deletions packages/api/src/mixins/ienable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ interface _IEnable extends IEnable<any> {
}

/**
* Mixin class decorator, injects IEnable default implementation, incl.
* a `_enabled` property. If the target also implements the
* {@link @thi.ng/api#INotify} interface, {@link IEnable.enable} and
* {@link IEnable.disable} will automatically emit the respective
* events.
* Mixin class decorator, injects IEnable default implementation, incl. a
* `_enabled` property. If the target also implements the {@link INotify}
* interface, {@link IEnable.enable} and {@link IEnable.disable} will
* automatically emit the respective events.
*/
export const IEnableMixin = mixin(<IEnable<any>>{
_enabled: true,
Expand Down
21 changes: 10 additions & 11 deletions packages/arrays/src/binary-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ import { compare } from "@thi.ng/compare/compare";
import { compareNumAsc } from "@thi.ng/compare/numeric";

/**
* Returns the supposed index of `x` in pre-sorted array-like collection
* `buf`.
* Returns the supposed index of `x` in pre-sorted array-like collection `buf`.
*
* @remarks
* If `x` can't be found, returns `-index-1`, representing the negative
* of the index, were `x` to be inserted into `buf`. E.g if the return
* value is -3, `x` would appear/insert at index 2.
* If `x` can't be found, returns `-index-1`, representing the negative of the
* index, were `x` to be inserted into `buf`. E.g if the return value is -3, `x`
* would appear/insert at index 2.
*
* The optional `key` function is used to obtain the actual sort value
* of `x` and each array item (default: identity).
* The optional `key` function is used to obtain the actual sort value of `x`
* and each array item (default: identity).
*
* The optional `cmp` comparator (default:
* {@link @thi.ng/compare#compare}) is then used to identify the index
* of `x`. The sort order of `buf` MUST be compatible with that of
* `cmp`.
* [`compare()`](https://docs.thi.ng/umbrella/compare/functions/compare.html))
* is then used to identify the index of `x`. The sort order of `buf` MUST be
* compatible with that of `cmp`.
*
* @example
* ```ts
Expand Down Expand Up @@ -58,7 +57,7 @@ export const binarySearch = <A, B>(
/**
* Similar to {@link binarySearch}, but optimized for numeric arrays and
* supporting custom comparators (default:
* {@link @thi.ng/compare#compareNumAsc}).
* [`compareNumAsc()`](https://docs.thi.ng/umbrella/compare/functions/compareNumAsc.html)).
*
* @param buf - array
* @param x - search value
Expand Down
11 changes: 6 additions & 5 deletions packages/arrays/src/ends-with.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { equiv as _eq } from "@thi.ng/equiv";

/**
* Returns true if the last items of `buf` are the same items as in
* `needle`.
* Returns true if the last items of `buf` are the same items as in `needle`.
*
* @remarks
* This means `buf` should have at least the same length as `needle` for
* this to be true.
* This means `buf` should have at least the same length as `needle` for this to
* be true.
*
* By default, uses {@link @thi.ng/equiv#equiv} for equality checking.
* By default, uses
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) for
* equality checking.
*
* {@link startsWith}
*
Expand Down
7 changes: 4 additions & 3 deletions packages/arrays/src/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Predicate2 } from "@thi.ng/api";
import { equiv as _equiv } from "@thi.ng/equiv";

/**
* Similar to `Array.find()`, but uses {@link @thi.ng/equiv#equiv} as
* Similar to `Array.find()`, but uses [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) as
* default predicate.
*
* @param buf - array
Expand All @@ -19,8 +19,9 @@ export const find = <T>(
};

/**
* Similar to `Array.findIndex()`, but uses {@link @thi.ng/equiv#equiv}
* as default predicate.
* Similar to `Array.findIndex()`, but uses
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) as
* default predicate.
*
* @param buf - array
* @param x - search value
Expand Down
10 changes: 6 additions & 4 deletions packages/arrays/src/fuzzy-match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { equiv as _eq } from "@thi.ng/equiv";
*
* @remarks
* The optional `equiv` predicate can be used to customize item equality
* checking. Uses {@link @thi.ng/equiv#equiv} by default.
* checking. Uses
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) by
* default.
*
* Adapted and generalized from:
* {@link https://github.com/bevacqua/fufuzzyzzysearch} (MIT)
* Adapted and generalized from: https://github.com/bevacqua/fufuzzyzzysearch
* (MIT licensed)
*
* {@link @thi.ng/transducers#(filterFuzzy:1)}
* [`filterFuzzy()`](https://docs.thi.ng/umbrella/transducers/functions/filterFuzzy.html)
*
* @param domain - array
* @param query - search value
Expand Down
11 changes: 6 additions & 5 deletions packages/arrays/src/is-sorted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import type { Comparator } from "@thi.ng/api";
import { compare } from "@thi.ng/compare/compare";

/**
* Returns true if the given array and its elements in the selected
* index range (entire array, by default) are in the order defined by
* the given comparator ({@link @thi.ng/compare#compare} by default).
* Returns true if the given array and its elements in the selected index range
* (entire array, by default) are in the order defined by the given comparator
* ([`compare()`](https://docs.thi.ng/umbrella/compare/functions/compare.html)
* by default).
*
* @remarks
* Always returns true, if effective index range (or array length) has
* less than two elements. No bounds checking.
* Always returns true, if effective index range (or array length) has less than
* two elements. No bounds checking.
*
* @example
* ```ts
Expand Down
19 changes: 10 additions & 9 deletions packages/arrays/src/quicksort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import { compare } from "@thi.ng/compare/compare";
import { swap } from "./swap.js";

/**
* In-place quicksort implementation with optional comparator & index
* based swap function, useful for sorting multiple related arrays in
* parallel, based on a single sort criteria.
* In-place quicksort implementation with optional comparator & index based swap
* function, useful for sorting multiple related arrays in parallel, based on a
* single sort criteria.
*
* @remarks
* Supports sorting of sub-ranges only, via optionally given
* `start`/`end` indices (both inclusive).
* Supports sorting of sub-ranges only, via optionally given `start`/`end`
* indices (both inclusive).
*
* Uses Hoare partitioning scheme. {@link @thi.ng/compare#compare} is
* used as default comparator and {@link swap} from this package as
* default swap function. Also see {@link multiSwap}.
* Uses Hoare partitioning scheme.
* [`compare()`](https://docs.thi.ng/umbrella/compare/functions/compare.html) is
* used as default comparator and {@link swap} from this package as default swap
* function. Also see {@link multiSwap}.
*
* {@link https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme}
* - https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme
*
* @example
* ```ts
Expand Down
10 changes: 5 additions & 5 deletions packages/arrays/src/shuffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { SYSTEM } from "@thi.ng/random/system";
import type { AnyArray } from "./api.js";

/**
* Shuffles the items in the given index range of array `buf` using
* Fisher-yates and optional `rnd` PRNG.
* Shuffles the items in the given index range of array `buf` using Fisher-yates
* and optional `rnd` PRNG.
*
* @remarks
* If neither `start` / `end` are given, the entire array will be
* shuffled. Mutates original array.
* If neither `start` / `end` are given, the entire array will be shuffled.
* Mutates original array.
*
* See {@link @thi.ng/random#IRandom}
* See [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
*
* @param buf - array
* @param n - num items
Expand Down
11 changes: 6 additions & 5 deletions packages/arrays/src/starts-with.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { equiv as _eq } from "@thi.ng/equiv";

/**
* Returns true if the first items of `buf` are the same items as in
* `needle`.
* Returns true if the first items of `buf` are the same items as in `needle`.
*
* @remarks
* This means `buf` should have at least the same length as `needle` for
* this to be true.
* This means `buf` should have at least the same length as `needle` for this to
* be true.
*
* By default, uses {@link @thi.ng/equiv#equiv} for equality checking.
* By default, uses
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) for
* equality checking.
*
* {@link endsWith}
*
Expand Down
16 changes: 8 additions & 8 deletions packages/arrays/src/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ export const swap = (arr: AnyArray, x: number, y: number) => {
};

/**
* Higher-order version of {@link swap} for swapping elements in
* multiple arrays at once and hence useful for sorting multiple arrays
* based on a single criteria.
* Higher-order version of {@link swap} for swapping elements in multiple arrays
* at once and hence useful for sorting multiple arrays based on a single
* criteria.
*
* @remarks
* The returned function takes the same args as `swap`, and when called
* swaps 2 elements in the array given to that function AND in the
* arrays given to {@link multiSwap} itself. Provides fast routes for up to 3
* extra arrays, then falls back to a loop-based approach.
* The returned function takes the same args as `swap`, and when called swaps 2
* elements in the array given to that function AND in the arrays given to
* {@link multiSwap} itself. Provides fast routes for up to 3 extra arrays, then
* falls back to a loop-based approach.
*
* {@link (quickSort:1)}
* {@link quickSort}
*
* @example
* ```ts
Expand Down
17 changes: 10 additions & 7 deletions packages/associative/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export interface EquivSetConstructor<T> {

export interface EquivSetOpts<T> {
/**
* Key equivalence predicate. MUST return truthy result if given
* keys are considered equal.
* Key equivalence predicate. MUST return truthy result if given keys are
* considered equal.
*
* @defaultValue {@link @thi.ng/equiv#equiv}
* @defaultValue
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html)
*/
equiv: Predicate2<T>;
}
Expand Down Expand Up @@ -65,7 +66,8 @@ export interface HashMapOpts<K> {
/**
* Optional key equality predicate.
*
* @defaultValue {@link @thi.ng/equiv#equiv}
* @defaultValue
* [`equiv()`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html)
*/
equiv?: Predicate2<K>;
/**
Expand All @@ -90,16 +92,17 @@ export interface HashMapOpts<K> {
*/
export interface SortedMapOpts<K> {
/**
* Key comparison function. Must follow standard comparator contract
* and return:
* Key comparison function. Must follow standard comparator contract and
* return:
* - negative if `a < b`
* - positive if `a > b`
* - `0` if `a == b`
*
* Note: The {@link SortedMap} implementation only uses `<` and `==` style
* comparisons.
*
* @defaultValue {@link @thi.ng/compare#compare}
* @defaultValue
* [`compare()`](https://docs.thi.ng/umbrella/compare/functions/compare.html)
*/
compare: Comparator<K>;
/**
Expand Down
Loading

0 comments on commit e549222

Please sign in to comment.