mountedAsAdded

tcmts.cli.libraries.mountedAsAdded · #fcvwf6px · term · runs anywhere

Whether a library's names are still the namespace it was added as: what's mounted, hashed as a namespace.

import { namesNow, within } from "#codebase/tcmts/cli/libraries";
import type { Library } from "#codebase/tcmts/cli/libraries";
import type { Store } from "#codebase/tcmts/store";

export function mountedAsAdded(store: Store, lib: Library): boolean {
  const rows = namesNow(store)
    .filter((n) => within(n.path, lib.path) && n.path !== lib.path)
    .map((n) => ({ ...n, path: n.path.slice(lib.path.length + 1) }));
  return store.namespaceOf(rows) === lib.namespace;
}

uses

used by