@vltpkg/dss-breadcrumb
Classes
Breadcrumb
Defined in: index.ts:37
The Breadcrumb class is used to represent a valid breadcrumb path that helps you traverse a graph and find a specific node or edge.
Alongside the traditional analogy, “Breadcrumb” is also being used here as a term used to describe the subset of the query language that uses only root/workspace selectors, id selectors & combinators.
The Breadcrumb class implements a doubly-linked list of items that can be used to navigate through the breadcrumb. The InteractiveBreadcrumb can also be used to keep track of state of the current breadcrumb item that should be used for checks.
It also validates that each element of the provided query string is valid according to the previous definition of a “Breadcrumb” query language subset.
Implements
Constructors
new Breadcrumb()
new Breadcrumb(query): Breadcrumb
Defined in: index.ts:45
Initializes the interactive breadcrumb with a query string.
Parameters
query
string
Returns
Properties
comment
comment: undefined | string
Defined in: index.ts:39
Implementation of
specificity
specificity: BreadcrumbSpecificity
Defined in: index.ts:40
Implementation of
ModifierBreadcrumb
.specificity
Accessors
first
Get Signature
get first(): ModifierBreadcrumbItem
Defined in: index.ts:174
Retrieves the first breadcrumb item.
Returns
Implementation of
last
Get Signature
get last(): ModifierBreadcrumbItem
Defined in: index.ts:184
Retrieves the last breadcrumb item.
Returns
Implementation of
single
Get Signature
get single(): boolean
Defined in: index.ts:195
Returns true
if the breadcrumb is composed of a single item.
Returns
boolean
Implementation of
Methods
[iterator]()
iterator: ArrayIterator<ModifierBreadcrumbItem>
Defined in: index.ts:199
Returns
ArrayIterator
<ModifierBreadcrumbItem
>
Implementation of
ModifierBreadcrumb.[iterator]
clear()
clear(): void
Defined in: index.ts:206
Empties the current breadcrumb list.
Returns
void
Implementation of
interactive()
interactive(): InteractiveBreadcrumb
Defined in: index.ts:218
Gets an InteractiveBreadcrumb instance that can be used to track state of the current breadcrumb item.
Returns
Implementation of
ModifierBreadcrumb
.interactive
InteractiveBreadcrumb
Defined in: index.ts:227
The InteractiveBreadcrumb is used to keep track of state of the current breadcrumb item that should be used for checks.
Implements
Constructors
new InteractiveBreadcrumb()
new InteractiveBreadcrumb(breadcrumb): InteractiveBreadcrumb
Defined in: index.ts:231
Parameters
breadcrumb
Returns
Accessors
current
Get Signature
get current(): | undefined | ModifierBreadcrumbItem
Defined in: index.ts:238
The current breadcrumb item.
Returns
| undefined
| ModifierBreadcrumbItem
Implementation of
ModifierInteractiveBreadcrumb.current
done
Get Signature
get done(): boolean
Defined in: index.ts:245
Returns true
if the current breadcrumb has no more items left.
Returns
boolean
Implementation of
ModifierInteractiveBreadcrumb.done
Methods
next()
next(): this
Defined in: index.ts:252
The next breadcrumb item.
Returns
this
Implementation of
ModifierInteractiveBreadcrumb.next
Interfaces
ModifierBreadcrumb
Defined in: types.ts:25
A breadcrumb is a linked list of items, where each item has a value and a type.
Extends
Iterable
<ModifierBreadcrumbItem
>
Properties
comment
comment: undefined | string
Defined in: types.ts:28
first
first: ModifierBreadcrumbItem
Defined in: types.ts:29
interactive()
interactive: () => ModifierInteractiveBreadcrumb
Defined in: types.ts:33
Returns
last
last: ModifierBreadcrumbItem
Defined in: types.ts:30
single
single: boolean
Defined in: types.ts:31
specificity
specificity: BreadcrumbSpecificity
Defined in: types.ts:32
Methods
clear()
clear(): void
Defined in: types.ts:27
Returns
void
Type Aliases
BreadcrumbSpecificity
type BreadcrumbSpecificity = object
Defined in: types.ts:4
The specificity of a breadcrumb, used for sorting.
Type declaration
commonCounter
commonCounter: number
idCounter
idCounter: number
ModifierBreadcrumbItem
type ModifierBreadcrumbItem = object
Defined in: types.ts:12
A valid item of a given breadcrumb.
Type declaration
importer
importer: boolean
name?
optional name: string;
next
next: | ModifierBreadcrumbItem | undefined;
prev
prev: | ModifierBreadcrumbItem | undefined;
type
type: string
value
value: string
ModifierInteractiveBreadcrumb
type ModifierInteractiveBreadcrumb = object
Defined in: types.ts:39
An interactive breadcrumb that holds state on what is the current item.
Type declaration
current
current: | ModifierBreadcrumbItem | undefined;
done
done: boolean
next()
next: () => ModifierInteractiveBreadcrumb
Returns
Functions
parseBreadcrumb()
function parseBreadcrumb(query): ModifierBreadcrumb
Defined in: index.ts:262
Returns an Breadcrumb list of items for a given query string.
Parameters
query
string
Returns
specificitySort()
function specificitySort(breadcrumbs): ModifierBreadcrumb[]
Defined in: index.ts:271
Sorts an array of Breadcrumb objects by specificity. Objects with higher idCounter values come first, if idCounter values are equal, then objects with higher commonCounter values come first. Otherwise, the original order is preserved.