Skip to content

Commit 2e3cb48

Browse files
authored
Merge pull request #17 from nberlette/docs/module-docs
docs: improve module doc comments
2 parents c4185f3 + c6e43d8 commit 2e3cb48

86 files changed

Lines changed: 810 additions & 31 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

deno.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/abs.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/**
22
* Performant local implementation of the `Math.abs` function.
33
*
4+
* @example
5+
* ```ts
6+
* import { abs } from "@nick/math/abs";
7+
* import assert from "node:assert";
8+
*
9+
* assert.strictEqual(abs(-3.5), 3.5);
10+
* ```
411
* @module abs
512
*/
613

src/acos.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
* Calculates the arccosine (inverse cosine) of a number, returning a value in
33
* the range `[0, π]`.
44
*
5+
* @example
6+
* ```ts
7+
* import { acos } from "@nick/math/acos";
8+
* import assert from "node:assert";
9+
*
10+
* assert.strictEqual(acos(1), 0);
11+
* ```
512
* @module acos
613
*/
714

src/acosh.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* the range `[0, +Infinity]`.
44
*
55
* @category Trigonometry
6+
* @example
7+
* ```ts
8+
* import { acosh } from "@nick/math/acosh";
9+
* import assert from "node:assert";
10+
*
11+
* assert.strictEqual(acosh(1), 0);
12+
* ```
613
* @module acosh
714
*/
815
import { NAN } from "./constants/nan.ts";

src/asin.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* range `[-π/2, π/2]`.
44
*
55
* @category Trigonometry
6+
* @example
7+
* ```ts
8+
* import { asin } from "@nick/math/asin";
9+
* import assert from "node:assert";
10+
*
11+
* assert.strictEqual(asin(0), 0);
12+
* ```
613
* @module asin
714
*/
815
import { NAN } from "./constants/nan.ts";

src/asinh.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/**
22
* Calculates the inverse hyperbolic sine of a number.
33
*
4+
* @example
5+
* ```ts
6+
* import { asinh } from "@nick/math/asinh";
7+
* import assert from "node:assert";
8+
*
9+
* assert.strictEqual(asinh(0), 0);
10+
* ```
411
* @module asinh
512
*/
613
import { isFinite } from "./guards/finite.ts";

src/atan.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
* Calculates the arctangent (inverse tangent) of a number, returning a value
33
* in the range `[-π/2, π/2]`.
44
*
5+
* @example
6+
* ```ts
7+
* import { atan } from "@nick/math/atan";
8+
* import assert from "node:assert";
9+
*
10+
* assert.strictEqual(atan(0), 0);
11+
* ```
512
* @module atan
613
*/
714
import { abs } from "./abs.ts";

src/atan2.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
* Calculates the arctangent of the quotient of its arguments, `y / x`,
33
* returning a value in the range `(-π, π]`.
44
*
5+
* @example
6+
* ```ts
7+
* import { atan2 } from "@nick/math/atan2";
8+
* import assert from "node:assert";
9+
*
10+
* assert.strictEqual(atan2(0, 1), 0);
11+
* ```
512
* @module atan2
613
*/
714
import { NAN } from "./constants/nan.ts";

src/atanh.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
* Calculates the inverse hyperbolic tangent of a number, returning a value in
33
* the range `[-∞, +∞]`.
44
*
5+
* @example
6+
* ```ts
7+
* import { atanh } from "@nick/math/atanh";
8+
* import assert from "node:assert";
9+
*
10+
* assert.strictEqual(atanh(0), 0);
11+
* ```
512
* @module atanh
613
*/
714
import { isNaN, NAN } from "./guards/nan.ts";

src/cbrt.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/**
22
* Calculates the cube root of a number, handling negative values as well.
33
*
4+
* @example
5+
* ```ts
6+
* import { cbrt } from "@nick/math/cbrt";
7+
* import assert from "node:assert";
8+
*
9+
* assert.ok(Math.abs(cbrt(27) - 3) < 1e-12);
10+
* ```
411
* @module cbrt
512
*/
613
import { abs } from "./abs.ts";

0 commit comments

Comments
 (0)