Skip to content

Commit

Permalink
docs: update doc strings (D-H pkgs)
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Nov 17, 2019
1 parent b875897 commit c2fd5aa
Show file tree
Hide file tree
Showing 53 changed files with 332 additions and 292 deletions.
18 changes: 9 additions & 9 deletions packages/defmulti/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ export interface MultiFnBase<I> {
* if successful. Returns false if an implementation already exists
* (and does nothing in this case).
*
* @param id -
* @param impl -
* @param id - implementation ID (dispatch value)
* @param impl - implementation
*/
add(id: PropertyKey, impl: I): boolean;
/**
Expand All @@ -189,21 +189,21 @@ export interface MultiFnBase<I> {
* added successfully. Note: Only numbers or strings are accepted as
* dispatch values here.
*
* @param impls -
* @param impls - object of implementations
*/
addAll(impls: IObjectOf<I>): boolean;
/**
* Removes implementation for dispatch value `id`. Returns true, if
* successful.
*
* @param id -
* @param id - implementation ID
*/
remove(id: PropertyKey): boolean;
/**
* Returns true, if the function is callable (has a valid
* implementation) for given arguments.
*
* @param args -
* @param args - arguments to find impl for
*/
callable(...args: any[]): boolean;
/**
Expand All @@ -215,8 +215,8 @@ export interface MultiFnBase<I> {
* delegate to `parent`'s implementation. I.e. in terms of dispatch
* logic, `id` is considered the same as `parent.
*
* @param id -
* @param parent -
* @param id - implementation ID
* @param parent -parent implementation ID
*/
isa(id: PropertyKey, parent: PropertyKey): boolean;
/**
Expand All @@ -229,13 +229,13 @@ export interface MultiFnBase<I> {
* Returns a set of immediate parent dispatch values for given
* dispatch value `id`.
*
* @param id -
* @param id - implementation ID
*/
parents(id: PropertyKey): Set<PropertyKey>;
/**
* Similar to {@link MultiFnBase.parents}, but includes all
* transitive parent dispatch values for given dispatch value `id`.
* @param id -
* @param id - implementation ID
*/
ancestors(id: PropertyKey): Set<PropertyKey>;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/defmulti/src/defmulti-n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import { defmulti } from "./defmulti";
* // two: 1, 2
* ```
*
* @param impls -
* @param fallback -
* @param impls - implementations
* @param fallback - fallback implementation
*/
export const defmultiN = <T>(
impls: { [id: number]: Implementation<T> },
Expand Down
10 changes: 5 additions & 5 deletions packages/defmulti/src/impls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ import { Implementation, MultiFn } from "./api";
* baz.impls(); // Set { "c", "a", "b" }
* ```
*
* @param type -
* @param impls -
* @param id - dispatch value / implementation ID
* @param impls - implementations
*/
export const implementations = (
type: PropertyKey,
id: PropertyKey,
rels: IObjectOf<MultiFn<any>[]>,
...impls: (MultiFn<any> | Implementation<any>)[]
) => {
Expand All @@ -68,11 +68,11 @@ export const implementations = (
if (rels) {
for (let parent in rels) {
for (let fn of rels[parent]) {
fn.isa(type, parent);
fn.isa(id, parent);
}
}
}
for (let i = 0; i < impls.length; i += 2) {
(<MultiFn<any>>impls[i]).add(type, impls[i + 1]);
(<MultiFn<any>>impls[i]).add(id, impls[i + 1]);
}
};
22 changes: 11 additions & 11 deletions packages/dsp/src/osc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const additive = (
* Interactive graph of this oscillator:
* {@link www.desmos.com/calculator/irugw6gnhy}
*
* @param n -
* @param n - number of octaves
*/
export const squareAdditive = (n = 8) =>
additive(
Expand All @@ -147,7 +147,7 @@ export const squareAdditive = (n = 8) =>
* Interactive graph of this oscillator:
* {@link https://www.desmos.com/calculator/irugw6gnhy}
*
* @param n -
* @param n - number of octaves
*/
export const sawAdditive = (n = 8) =>
additive(
Expand All @@ -165,8 +165,8 @@ export const sawAdditive = (n = 8) =>
* Interactive graph:
* {@link https://www.desmos.com/calculator/irugw6gnhy}
*
* @param n -
* @param i -
* @param n - number of octaves
* @param i - curr octave [1..n]
*/
export const gibbs = (n: number, i: number) =>
Math.pow(Math.cos(((i - 1) * HALF_PI) / n), 2);
Expand All @@ -177,12 +177,12 @@ export const gibbs = (n: number, i: number) =>
* - {@link http://research.spa.aalto.fi/publications/papers/smc2010-phaseshaping/}
* - {@link http://www.kvraudio.com/forum/viewtopic.php?t=375517}
*
* @param eps -
* @param x -
* @param dt - time step
* @param t - phase
*/
export const polyBLEP = (eps: number, x: number) =>
x < eps
? ((x /= eps), x + x - x * x - 1)
: x > 1 - eps
? ((x = (x - 1) / eps), x * x + x + x + 1)
export const polyBLEP = (dt: number, t: number) =>
t < dt
? ((t /= dt), t + t - t * t - 1)
: t > 1 - dt
? ((t = (t - 1) / dt), t * t + t + t + 1)
: 0;
8 changes: 4 additions & 4 deletions packages/fsm/src/alts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import { result } from "./result";
* Note: Matchers are always processed in reverse order, therefore
* attention must be paid to the given ordering of supplied matchers.
*
* @param opts -
* @param fallback -
* @param success -
* @param fail -
* @param opts - child matchers
* @param fallback - fallback callback
* @param success - success callback
* @param fail - failure callback
*/
export const alts = <T, C, R>(
opts: Matcher<T, C, R>[],
Expand Down
10 changes: 5 additions & 5 deletions packages/fsm/src/fsm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ import { Match, Matcher } from "./api";
* If the optional `src` iterable is given, the function returns a
* transforming iterator of the FSM results.
*
* @param states -
* @param ctx -
* @param initialState -
* @param update -
* @param src -
* @param states - FSM state matchers
* @param ctx - FSM context object
* @param initialState - initial state ID
* @param update - context update fn
* @param src - input
*/
export function fsm<T, C, R>(
states: IObjectOf<Matcher<T, C, R>>,
Expand Down
13 changes: 9 additions & 4 deletions packages/fsm/src/not.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Match, Matcher, RES_PARTIAL, SeqCallback } from "./api";
import {
Match,
Matcher,
RES_PARTIAL,
SeqCallback
} from "./api";
import { result } from "./result";

/**
Expand All @@ -7,9 +12,9 @@ import { result } from "./result";
* the new matcher returns `Match.FAIL` and vice versa. `Match.PARTIAL`
* results remain as is.
*
* @param match -
* @param success -
* @param fail -
* @param match - matcher to invert
* @param success - success callback
* @param fail - failure callback
*/
export const not = <T, C, R>(
match: Matcher<T, C, R>,
Expand Down
24 changes: 12 additions & 12 deletions packages/fsm/src/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { result } from "./result";
* Returns a single input matcher which returns `Match.FULL` if the
* input is within the closed interval given by [`min`,`max`].
*
* @param min -
* @param max -
* @param success -
* @param fail -
* @param min - min repetitions
* @param max - max repetitions
* @param success - success callback
* @param fail - failure callback
*/
export const range = <T extends number | string, C, R>(
min: T,
Expand All @@ -30,8 +30,8 @@ export const range = <T extends number | string, C, R>(
/**
* Matcher for single digit characters (0-9).
*
* @param success -
* @param fail -
* @param success - success callback
* @param fail - failure callback
*/
export const digit = <C, R>(
success?: LitCallback<string, C, R>,
Expand All @@ -41,8 +41,8 @@ export const digit = <C, R>(
/**
* Matcher for single A-Z or a-z characters.
*
* @param success -
* @param fail -
* @param success - success callback
* @param fail - failure callback
*/
export const alpha = <C, R>(
success?: AltCallback<string, C, R>,
Expand All @@ -58,8 +58,8 @@ export const alpha = <C, R>(
/**
* Combination of {@link digit} and {@link alpha}.
*
* @param success -
* @param fail -
* @param success - success callback
* @param fail - failure callback
*/
export const alphaNum = <C, R>(
success?: AltCallback<string, C, R>,
Expand All @@ -71,8 +71,8 @@ const WS = new Set([" ", "\n", "\t", "\r"]);
/**
* Matcher for single whitespace characters.
*
* @param success -
* @param fail -
* @param success - success callback
* @param fail - failure callback
*/
export const whitespace = <C, R>(
success?: LitCallback<string, C, R>,
Expand Down
17 changes: 11 additions & 6 deletions packages/fsm/src/repeat.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { Match, Matcher, RES_PARTIAL, SeqCallback } from "./api";
import {
Match,
Matcher,
RES_PARTIAL,
SeqCallback
} from "./api";
import { result } from "./result";

/**
* Takes a matcher and `min` / `max` repeats. Returns new matcher which
* only returns `Match.FULL` if `match` succeeded at least `min` times
* or once `max` repetitions have been found.
*
* @param match -
* @param min -
* @param max -
* @param success -
* @param fail -
* @param match - matcher
* @param min -min repetitions
* @param max - max repetitions
* @param success - success callback
* @param fail - failure callback
*/
export const repeat = <T, C, R>(
match: Matcher<T, C, R>,
Expand Down
13 changes: 9 additions & 4 deletions packages/fsm/src/seq.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { Match, Matcher, RES_PARTIAL, SeqCallback } from "./api";
import {
Match,
Matcher,
RES_PARTIAL,
SeqCallback
} from "./api";
import { result } from "./result";

/**
* Takes an array of matchers and returns new matcher which applies them
* in sequence. If any of the given matchers fails, returns
* `Match.FAIL`.
*
* @param matches -
* @param success -
* @param fail -
* @param matches - child matchers
* @param success - success callback
* @param fail - failure callback
*/
export const seq = <T, C, R>(
matches: Matcher<T, C, R>[],
Expand Down
8 changes: 4 additions & 4 deletions packages/fsm/src/str.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { result } from "./result";
* string to `fail` callback. If `collect` is true, the failed callback
* will be called with the collected input.
*
* @param str -
* @param success -
* @param fail -
* @param collect -
* @param str - search string
* @param success - success callback
* @param fail - failure callback
* @param collect - true, if input is to be collected/buffered
*/
export const str = <C, R>(
str: string,
Expand Down
8 changes: 4 additions & 4 deletions packages/fsm/src/until.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { result } from "./result";
* (excluding the matched terminator string) and returns `Match.FULL`
* result. Else `Match.PARTIAL`.
*
* @param str -
* @param callback -
* @param str - termination string
* @param callback - result callback
*/
export const untilStr = <C, R>(
str: string,
Expand All @@ -33,8 +33,8 @@ export const untilStr = <C, R>(
/**
* Generic array version of {@link untilStr}.
*
* @param str -
* @param callback -
* @param str - termination sequence
* @param callback - result callback
*/
export const until = <T, C, R>(
str: T[],
Expand Down
14 changes: 7 additions & 7 deletions packages/geom-accel/src/kdtree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ export class KdTree<K extends ReadonlyVec, V>
/**
* Returns node for point or `undefined` if none found.
*
* @param p -
* @param node -
* @param p - point
* @param node - tree node
* @param epsSq - squared epsilon / tolerance
*/
const find = <K extends ReadonlyVec, V>(
Expand Down Expand Up @@ -284,7 +284,7 @@ const findMin = <K extends ReadonlyVec, V>(
/**
* Returns true if root is to be deleted.
*
* @param node -
* @param node - tree node
*/
const remove = <K extends ReadonlyVec, V>(node: KdNode<K, V>) => {
if (!node.l && !node.r) {
Expand Down Expand Up @@ -339,10 +339,10 @@ const nearest = <K extends ReadonlyVec, V>(
/**
* Optimized version of {@link nearest} for single closest point search.
*
* @param q -
* @param acc -
* @param dims -
* @param node -
* @param q - search point
* @param acc - accumulator
* @param dims - dimensions
* @param node - tree node
*/
const nearest1 = <K extends ReadonlyVec, V>(
q: K,
Expand Down
Loading

0 comments on commit c2fd5aa

Please sign in to comment.