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
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];
0 commit comments