IF Commons GitHub

modules/name

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0001-ergonex FR-005

The name of a module (commons 0001-ergonex FR-005, FR-006): lower-case letters, digits and hyphens, beginning with a letter, at most 32 characters. A name with a path separator, a space, a dot or any other character is refused before it is looked for and is never passed to a shell; a name no module has is answered with the nearest names.

Source: commons/ergonex/src/modules/name.ts

2 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

describeNameErrorfunctionno test imports it
function describeNameError(e: NameError): string

A refusal as one sentence.

ModuleNametypeno test imports it
type ModuleName = Brand<string, "ModuleName">;

The name of a module: ergonex <name> runs the module ergonex-<name>.

moduleNamefunction
function moduleName(text: string): Result<ModuleName, NameError>

A module name from text, or why it is refused. The text is judged as it is: no trimming and no case folding.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

nearestNamesfunction
function nearestNames(word: string, names: readonly string[]): readonly string[]

The modules nearest a name nobody has: up to three, within an edit distance of two, the nearest first and, among equals, in alphabetical order.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.