open-memex
Version:
Local-first memory layer and protocol for AI coding agents. Markdown source of truth, SQLite FTS5 index, zero cloud.
22 lines (21 loc) • 512 B
JavaScript
export function selectProfileItems(preferences, allNewestFirst, cap) {
const out = [];
const seen = new Set();
for (const m of preferences) {
if (out.length >= cap)
break;
if (seen.has(m.id))
continue;
seen.add(m.id);
out.push(m);
}
for (const m of allNewestFirst) {
if (out.length >= cap)
break;
if (seen.has(m.id))
continue;
seen.add(m.id);
out.push(m);
}
return out;
}