@altostra/core
Version:
Core library for shared types and logic
67 lines (66 loc) • 2.18 kB
TypeScript
import { ListNode } from "./ImmutableList";
import type { ParameterPath } from "./ParameterPath";
/**
* Builder class to build valid parameter paths
*/
export declare class ParameterPathBuilder {
#private;
/**
* Gets the path separator
*/
static readonly pathSeparator = "/";
/**
* Gets the path separator
*/
readonly pathSeparator = "/";
/**
* Creates new instance
* @param path The path to create the builder for
*/
constructor(path: ListNode<string> | string);
/**
* Gets the path represented by this helper
*/
get path(): ParameterPath;
/**
* Gets the count of path part
*/
get length(): number;
/**
* Gets an iterable of path parts
*/
get parts(): Iterable<string>;
/**
* Creates new path builder for the path with the appended parts
* @param keys The parts to append to the path
*/
append(...keys: string[]): ParameterPathBuilder;
/**
* Returns a path builder for the path X level up this path
* @param levels The count of levels to back up. defaults to `1`
*/
backUp(levels?: import("@altostra/common/CustomTypes/Numerics").NaturalNumber): ParameterPathBuilder;
toString(): ParameterPath;
valueOf(): ParameterPath;
/**
* Checks if this path starts with all the parts in the provided path
* @param other The path to check
* @returns `true` if this path starts with the provided path; \
* Otherwise, `false`
*/
startsWith(other: ParameterPath | ParameterPathBuilder): boolean;
/**
* Checks if other path is in conflict with this path. \
*
* A conflicting path is either starts with this path, or this starts with the other.
* @param other The path to check
* @returns `true` if paths are in conflict; otherwise, `false`.
*/
isConflictingWith(other: ParameterPath | ParameterPathBuilder): boolean;
/**
* Checks if this path equals other path
* @param other The path to check
* @returns `true` if the paths are equal; otherwise, `false`.
*/
equals(other: ParameterPath | ParameterPathBuilder): boolean;
}