function preferredFirst
preferredFirst(
found: readonly string[],
asked: readonly string[],
cwd: string
): string[]

The preload list with, in each group of files that want one name, the one that should keep it moved to the front.

An index is the door into a directory, so it goes first by default. Naming a file yourself AFTER a wildcard beats that: qunitx repl 'lib/task/*' lib/task/task.ts. Quote the pattern — unquoted, your shell expands it before qunitx starts, both files arrive as ordinary paths with nothing left to say which was a glob, and applyInputs deduplicates a repeat anyway.

import { preferredFirst } from './session.ts';

const found = ['/p/task/task.ts', '/p/task/index.ts'];
preferredFirst(found, ['task/*'], '/p')[0]; // '/p/task/index.ts'
preferredFirst(found, ['task/*', 'task/task.ts'], '/p')[0]; // '/p/task/task.ts'

Parameters

found: readonly string[]
asked: readonly string[]
cwd: string

Return Type

string[]

Usage

import { preferredFirst } from "lib/repl/session.ts";