shelving
Version:
Toolkit for using data in JavaScript.
23 lines (22 loc) • 1.11 kB
TypeScript
import type { AnyCaller } from "../util/function.js";
import type { AbsolutePath, RelativePath } from "../util/path.js";
import { BusyStore } from "./BusyStore.js";
/**
* Store an absolute path, e.g. `/a/b/c`
*
* @param path: The initial value for the store.
* @param base: The base path to resolve relative paths against.
*/
export declare class PathStore extends BusyStore<AbsolutePath, AbsolutePath | RelativePath> {
readonly base: AbsolutePath;
constructor(path?: AbsolutePath | RelativePath, base?: AbsolutePath);
protected _convert(possible: AbsolutePath | RelativePath, caller: AnyCaller): AbsolutePath;
protected _equal(a: AbsolutePath, b: AbsolutePath): boolean;
/** Based on the current store path, is a path active? */
isActive(path: AbsolutePath): boolean;
/** Based on the current store path, is a path proud (i.e. a child of the current store path)? */
isProud(path: AbsolutePath): boolean;
/** Get an absolute path from a path relative to the current store path. */
getPath(path: AbsolutePath | RelativePath): AbsolutePath;
toString(): string;
}