7 lines
266 B
TypeScript
7 lines
266 B
TypeScript
export const MAX_RECENTS = 12;
|
|
|
|
/** Puts `path` first, drops an older copy of it, and keeps at most MAX_RECENTS paths. */
|
|
export function addRecent(list: string[], path: string): string[] {
|
|
return [path, ...list.filter((p) => p !== path)].slice(0, MAX_RECENTS);
|
|
}
|