IF Commons GitHub

logical/rewrite

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-bridge-plans FR-007

The rules that map the path of a file at the source to its path at the destination, as pure functions with a reason where they cannot: put a prefix before every path, take one off, fold the case, and run one rule after another.

import { addPrefix } from "./rewrite.ts";
// addPrefix("backup") maps "a/b" to "backup/a/b"

Source: commons/anyfs-bridge/src/logical/rewrite.ts

4 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.

addPrefixconst
const addPrefix: (prefix: Prefix) => Rewrite

Puts a prefix before every path.

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

stripPrefixconst
const stripPrefix: (prefix: Prefix) => Rewrite

Takes a prefix off every path; a path that is not under it cannot be rewritten.

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

lowerCaseconst
const lowerCase: Rewrite

Folds every path to lower case.

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

composeconst
const compose: (...rules: readonly Rewrite[]) => Rewrite

One rule after another: the first that cannot make a path is the reason.

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

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