sortNewestFirst (core/sort-newest-first.ts)

inbrain · src/core/sort-newest-first.ts · typescript · MIT
ui, tag:embed-classified

* Sort brain paths newest-first by lexicographic descending. Brain paths are date-prefixed by convention (meetings/2026-05-13-*, daily/2026-05-13.md), so descending lex order naturally prioritizes recent content. For non-date-prefixed paths (concepts/, wiki/, people/, etc.) the o

// Source: https://github.com/inbrainfun/inbrain | License: MIT | Copyright 2026 Inbrain Contributors
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Sort brain paths newest-first by lexicographic descending.
 *
 * Brain paths are date-prefixed by convention (meetings/2026-05-13-*,
 * daily/2026-05-13.md), so descending lex order naturally prioritizes recent
 * content. For non-date-prefixed paths (concepts/, wiki/, people/, etc.) the
 * order is deterministic but reverse-alphabetical — there is no salience
 * signal to optimize for there, but consistency keeps logs and progress
 * output predictable across runs.
 *
 * Mutates in place AND returns the same array, so callers can chain or
 * just rely on the side effect:
 *
 *   sortNewestFirst(allFiles);          // 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key