Skip to content

Commit 5340043

Browse files
committed
Update docs headings from '###' to '##'
1 parent 7fe328d commit 5340043

33 files changed

Lines changed: 218 additions & 201 deletions

packages/common/src/Array.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Array types, type guards, operations, transformations, accessors, and (rare)
33
* mutations
44
*
5-
* ### Example
5+
* ## Example
66
*
77
* ```ts
88
* // Types - compile-time guarantee of at least one element
@@ -66,7 +66,7 @@
6666
* const result = firstInArray(mapped);
6767
* ```
6868
*
69-
* ### Why data-first?
69+
* ## Why data-first?
7070
*
7171
* Evolu optimizes for consistent code style. We can't have both data-first
7272
* single operations and curried data-last helpers without sacrificing
@@ -103,7 +103,7 @@ export type NonEmptyReadonlyArray<T> = readonly [T, ...ReadonlyArray<T>];
103103
*
104104
* Use `if (!isNonEmptyArray(arr))` for empty checks.
105105
*
106-
* ### Example
106+
* ## Example
107107
*
108108
* ```ts
109109
* const arr: Array<number> = [1, 2, 3];
@@ -124,7 +124,7 @@ export const isNonEmptyArray = <T>(
124124
*
125125
* Use `if (!isNonEmptyReadonlyArray(arr))` for empty checks.
126126
*
127-
* ### Example
127+
* ## Example
128128
*
129129
* ```ts
130130
* const arr: ReadonlyArray<number> = [1, 2, 3];
@@ -144,7 +144,7 @@ export const isNonEmptyReadonlyArray = <T>(
144144
*
145145
* Accepts both mutable and readonly arrays. Does not mutate the original array.
146146
*
147-
* ### Example
147+
* ## Example
148148
*
149149
* ```ts
150150
* appendToArray([1, 2, 3], 4); // [1, 2, 3, 4]
@@ -163,7 +163,7 @@ export const appendToArray = <T>(
163163
*
164164
* Accepts both mutable and readonly arrays. Does not mutate the original array.
165165
*
166-
* ### Example
166+
* ## Example
167167
*
168168
* ```ts
169169
* prependToArray([2, 3], 1); // [1, 2, 3]
@@ -181,7 +181,7 @@ export const prependToArray = <T>(
181181
*
182182
* Accepts both mutable and readonly arrays. Preserves non-empty type.
183183
*
184-
* ### Example
184+
* ## Example
185185
*
186186
* ```ts
187187
* mapArray([1, 2, 3], (x) => x * 2); // [2, 4, 6]
@@ -213,15 +213,15 @@ export function mapArray<T, U>(
213213
* type to the narrowed type, making it useful for filtering with Evolu Types
214214
* like `PositiveInt.is`.
215215
*
216-
* ### Examples
216+
* ## Examples
217217
*
218-
* #### With predicate
218+
* ### With predicate
219219
*
220220
* ```ts
221221
* filterArray([1, 2, 3, 4, 5], (x) => x % 2 === 0); // [2, 4]
222222
* ```
223223
*
224-
* #### With refinement
224+
* ### With refinement
225225
*
226226
* ```ts
227227
* const mixed: ReadonlyArray<NonEmptyString | PositiveInt> = [
@@ -258,7 +258,7 @@ export function filterArray<T>(
258258
* Accepts both mutable and readonly arrays. Does not mutate the original array.
259259
* Preserves non-empty type.
260260
*
261-
* ### Example
261+
* ## Example
262262
*
263263
* ```ts
264264
* // Dedupe primitives by value
@@ -314,9 +314,9 @@ export function dedupeArray<T>(
314314
* TypeScript will narrow the first array to the narrowed type, making it useful
315315
* for filtering with Evolu Types like `PositiveInt.is`.
316316
*
317-
* ### Examples
317+
* ## Examples
318318
*
319-
* #### With predicate
319+
* ### With predicate
320320
*
321321
* ```ts
322322
* const [evens, odds] = partitionArray(
@@ -327,7 +327,7 @@ export function dedupeArray<T>(
327327
* odds; // [1, 3, 5]
328328
* ```
329329
*
330-
* #### With refinement
330+
* ### With refinement
331331
*
332332
* ```ts
333333
* const mixed: ReadonlyArray<NonEmptyString | PositiveInt> = [
@@ -372,7 +372,7 @@ export function partitionArray<T>(
372372
*
373373
* Accepts both mutable and readonly arrays. Does not mutate the original array.
374374
*
375-
* ### Example
375+
* ## Example
376376
*
377377
* ```ts
378378
* firstInArray(["a", "b", "c"]); // "a"
@@ -387,7 +387,7 @@ export const firstInArray = <T>(array: NonEmptyReadonlyArray<T>): T => array[0];
387387
*
388388
* Accepts both mutable and readonly arrays. Does not mutate the original array.
389389
*
390-
* ### Example
390+
* ## Example
391391
*
392392
* ```ts
393393
* lastInArray(["a", "b", "c"]); // "c"
@@ -403,7 +403,7 @@ export const lastInArray = <T>(array: NonEmptyReadonlyArray<T>): T =>
403403
*
404404
* **Mutates** the original array.
405405
*
406-
* ### Example
406+
* ## Example
407407
*
408408
* ```ts
409409
* const arr: NonEmptyArray<number> = [1, 2, 3];
@@ -420,7 +420,7 @@ export const shiftArray = <T>(array: NonEmptyArray<T>): T => array.shift() as T;
420420
*
421421
* **Mutates** the original array.
422422
*
423-
* ### Example
423+
* ## Example
424424
*
425425
* ```ts
426426
* const arr: NonEmptyArray<number> = [1, 2, 3];

packages/common/src/Assert.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { Type } from "./Type.js";
1212
* TypeScript, or for catching and signaling developer mistakes eagerly (e.g.,
1313
* invalid configuration).
1414
*
15-
* ### Example
15+
* ## Example
1616
*
1717
* ```ts
1818
* assert(true, "true is not true"); // no-op
@@ -42,7 +42,7 @@ export const assert: (
4242
* the array as non-empty when this is logically guaranteed but not statically
4343
* known.
4444
*
45-
* ### Example
45+
* ## Example
4646
*
4747
* ```ts
4848
* assertNonEmptyArray([1, 2, 3]); // no-op
@@ -66,7 +66,7 @@ export const assertNonEmptyArray: <T>(
6666
* TypeScript infer non-emptiness when this is logically guaranteed but not
6767
* statically known.
6868
*
69-
* ### Example
69+
* ## Example
7070
*
7171
* ```ts
7272
* assertNonEmptyReadonlyArray([1, 2, 3]); // no-op

packages/common/src/BigInt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const clampBigInt =
1515
/**
1616
* Creates a predicate that checks if a BigInt is within a range, inclusive.
1717
*
18-
* ### Example
18+
* ## Example
1919
*
2020
* ```ts
2121
* const isBetween10And20 = isBetweenBigInt(10n, 20n);

packages/common/src/Brand.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Supports multiple brands, allowing types to act like flags.
88
*
9-
* ### Example 1: Single Brand
9+
* ## Example 1: Single Brand
1010
*
1111
* ```ts
1212
* // A branded type definition
@@ -30,7 +30,7 @@
3030
* getUser("123"); // ❌ TypeScript error
3131
* ```
3232
*
33-
* ### Example 2: Multiple Brands
33+
* ## Example 2: Multiple Brands
3434
*
3535
* ```ts
3636
* // Define branded types
@@ -56,7 +56,7 @@
5656
* requiresMax100(min1Max100Value); // ✅ Valid: Min1Max100 satisfies Max100
5757
* ```
5858
*
59-
* ### Example 3: Standalone Brand
59+
* ## Example 3: Standalone Brand
6060
*
6161
* Brand can be used alone without a base type for purely nominal typing. This
6262
* is useful for opaque values where the internal structure is hidden and type
@@ -87,7 +87,7 @@ declare const __brand: unique symbol;
8787
*
8888
* Works with any base type intersected with a `Brand`.
8989
*
90-
* ### Example
90+
* ## Example
9191
*
9292
* - `IsBranded<string>` -> false
9393
* - `IsBranded<string & Brand<"X">>` -> true

packages/common/src/Buffer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class BufferError extends Error {
2727
* its capacity) to minimize memory reallocations and uses `subarray` for
2828
* efficient, copy-free data access in methods like `unwrap` and `shift`.
2929
*
30-
* ### Recommended Usage
30+
* ## Recommended Usage
3131
*
3232
* Create as few Buffers as possible—typically one main Buffer for the final
3333
* output. Temporary Buffers are allowed when necessary (e.g., for
@@ -42,7 +42,7 @@ export class BufferError extends Error {
4242
* avoids allocation overhead in success cases and leverages exceptions'
4343
* diagnostic benefits.
4444
*
45-
* ### Example
45+
* ## Example
4646
*
4747
* ```ts
4848
* const buffer = createBuffer();

packages/common/src/Cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface Cache<K, V> {
3131
* When the cache reaches capacity, the least recently used entry is evicted.
3232
* Both `get` and `set` operations update the access order.
3333
*
34-
* ### Example
34+
* ## Example
3535
*
3636
* ```ts
3737
* const cache = createLruCache<string, number>(2);

packages/common/src/Callbacks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { createId, Id } from "./Type.js";
1616
* The `execute` method intentionally does not use try-catch or {@link Result}
1717
* because it's the callback's responsibility to handle its own errors.
1818
*
19-
* ### Example
19+
* ## Example
2020
*
2121
* ```ts
2222
* // No-argument callbacks

packages/common/src/Console.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
* **Convention**: Use a tag (e.g., `[db]`) as the first argument for log
1010
* filtering.
1111
*
12-
* ### Example
12+
* ## Example
1313
*
1414
* ```ts
1515
* deps.console.log("[evolu]", "createEvoluInstance", { name });
1616
* ```
1717
*
18-
* **Tip**: In browser dev tools, you can filter logs by tag (e.g., `[db]`) to
18+
* **Tip**: In browser dev tools, we can filter logs by tag (e.g., `[db]`) to
1919
* quickly find relevant messages. In Node.js, use `grep` to filter output:
2020
*
2121
* ```bash

packages/common/src/Crypto.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface RandomBytes {
2323
* generator (crypto.getRandomValues) to generate high-quality entropy
2424
* suitable for cryptographic operations.
2525
*
26-
* ### Type Safety
26+
* ## Type Safety
2727
*
2828
* Returns specific branded types for common sizes:
2929
*
@@ -33,7 +33,7 @@ export interface RandomBytes {
3333
* - `Random64` for 64-byte values (512 bits)
3434
* - `Random` for any other size
3535
*
36-
* ### Example
36+
* ## Example
3737
*
3838
* ```ts
3939
* const nonce = randomBytes.create(16); // Type: Random16
@@ -137,7 +137,7 @@ export type XChaCha20Poly1305Ciphertext =
137137
* Generates a random nonce internally and returns both the ciphertext and
138138
* nonce. The nonce must be stored alongside the ciphertext for decryption.
139139
*
140-
* ### Example
140+
* ## Example
141141
*
142142
* ```ts
143143
* const deps = { randomBytes: createRandomBytes() };
@@ -174,7 +174,7 @@ export interface DecryptWithXChaCha20Poly1305Error {
174174
* {@link Result} that may contain a decryption error if the ciphertext was
175175
* tampered with or the wrong key/nonce was used.
176176
*
177-
* ### Example
177+
* ## Example
178178
*
179179
* ```ts
180180
* const result = decryptWithXChaCha20Poly1305(

packages/common/src/Eq.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const eqFromOrder =
2929
* Creates an equivalence function for array-like structures based on an
3030
* equivalence for their elements.
3131
*
32-
* ### Example
32+
* ## Example
3333
*
3434
* ```ts
3535
* const eqArrayNumber = createEqArrayLike(eqNumber);
@@ -54,7 +54,7 @@ export const createEqArrayLike =
5454
/**
5555
* Compares two array-like structures of numbers for equality.
5656
*
57-
* ### Example
57+
* ## Example
5858
*
5959
* ```ts
6060
* eqArrayNumber([1, 2, 3], [1, 2, 3]); // true (works with regular arrays)
@@ -68,7 +68,7 @@ export const eqArrayNumber = createEqArrayLike(eqNumber);
6868
* Creates an equivalence function for objects based on an equivalence for their
6969
* fields.
7070
*
71-
* ### Example
71+
* ## Example
7272
*
7373
* ```ts
7474
* const eqObjectNumber = createEqObject({ a: eqNumber });
@@ -100,7 +100,7 @@ export const createEqObject =
100100
* serialization overhead and leveraging short-circuit evaluation for faster
101101
* failure on mismatched structures.
102102
*
103-
* ### Example
103+
* ## Example
104104
*
105105
* ```ts
106106
* const obj1: Json = { name: "Alice", hobbies: ["reading", "hiking"] };
@@ -190,7 +190,7 @@ export const eqJsonValue = (a: JsonValue, b: JsonValue): boolean => {
190190
* serialization overhead and leveraging short-circuit evaluation for faster
191191
* failure on mismatched structures.
192192
*
193-
* ### Example
193+
* ## Example
194194
*
195195
* ```ts
196196
* const obj1: Json = { name: "Alice", hobbies: ["reading", "hiking"] };

0 commit comments

Comments
 (0)