@vltpkg/dss-breadcrumb
Classes
Breadcrumb
Defined in: index.ts:169
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 pseudo 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): BreadcrumbDefined in: index.ts:178
Initializes the interactive breadcrumb with a query string.
Parameters
query
string
Returns
Properties
comment
comment: undefined | stringDefined in: index.ts:171
Implementation of
specificity
specificity: BreadcrumbSpecificityDefined in: index.ts:172
Implementation of
ModifierBreadcrumb.specificity
Accessors
first
Get Signature
get first(): ModifierBreadcrumbItemDefined in: index.ts:338
Retrieves the first breadcrumb item.
Returns
Implementation of
last
Get Signature
get last(): ModifierBreadcrumbItemDefined in: index.ts:348
Retrieves the last breadcrumb item.
Returns
Implementation of
single
Get Signature
get single(): booleanDefined in: index.ts:359
Returns true if the breadcrumb is composed of a single item.
Returns
boolean
Implementation of
Methods
[iterator]()
iterator: ArrayIterator<ModifierBreadcrumbItem>Defined in: index.ts:363
Returns
ArrayIterator<ModifierBreadcrumbItem>
Implementation of
ModifierBreadcrumb.[iterator]clear()
clear(): voidDefined in: index.ts:370
Empties the current breadcrumb list.
Returns
void
Implementation of
interactive()
interactive(): InteractiveBreadcrumbDefined in: index.ts:382
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:391
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): InteractiveBreadcrumbDefined in: index.ts:395
Parameters
breadcrumb
Returns
Accessors
current
Get Signature
get current(): | undefined | ModifierBreadcrumbItemDefined in: index.ts:402
The current breadcrumb item.
Returns
| undefined | ModifierBreadcrumbItem
Implementation of
ModifierInteractiveBreadcrumb.currentdone
Get Signature
get done(): booleanDefined in: index.ts:409
Returns true if the current breadcrumb has no more items left.
Returns
boolean
Implementation of
ModifierInteractiveBreadcrumb.doneMethods
next()
next(): thisDefined in: index.ts:416
The next breadcrumb item.
Returns
this
Implementation of
ModifierInteractiveBreadcrumb.nextInterfaces
ModifierBreadcrumb
Defined in: types.ts:40
A breadcrumb is a linked list of items, where each item has a value and a type.
Extends
Iterable<ModifierBreadcrumbItem>
Properties
comment
comment: undefined | stringDefined in: types.ts:43
first
first: ModifierBreadcrumbItemDefined in: types.ts:44
interactive()
interactive: () => ModifierInteractiveBreadcrumbDefined in: types.ts:48
Returns
last
last: ModifierBreadcrumbItemDefined in: types.ts:45
single
single: booleanDefined in: types.ts:46
specificity
specificity: BreadcrumbSpecificityDefined in: types.ts:47
Methods
clear()
clear(): voidDefined in: types.ts:42
Returns
void
Type Aliases
BreadcrumbSpecificity
type BreadcrumbSpecificity = objectDefined in: types.ts:4
The specificity of a breadcrumb, used for sorting.
Type declaration
commonCounter
commonCounter: numberidCounter
idCounter: numberInternalModifierComparatorOptions
type InternalModifierComparatorOptions = objectDefined in: types.ts:12
Options for the higher-level comparing breadcrumbs function.
Type declaration
range?
optional range: string;ModifierBreadcrumbItem
type ModifierBreadcrumbItem = objectDefined in: types.ts:26
A valid item of a given breadcrumb.
Type declaration
comparator()
comparator: opts => booleanParameters
opts
Returns
boolean
importer
importer: booleanname?
optional name: string;next
next: | ModifierBreadcrumbItem | undefined;prev
prev: | ModifierBreadcrumbItem | undefined;type
type: stringvalue
value: stringModifierComparatorOptions
type ModifierComparatorOptions = objectDefined in: types.ts:19
Options for comparing breadcrumbs.
Type declaration
semver?
optional semver: string;ModifierInteractiveBreadcrumb
type ModifierInteractiveBreadcrumb = objectDefined in: types.ts:54
An interactive breadcrumb that holds state on what is the current item.
Type declaration
current
current: | ModifierBreadcrumbItem | undefined;done
done: booleannext()
next: () => ModifierInteractiveBreadcrumbReturns
Functions
extractPseudoParameter()
function extractPseudoParameter(item): ParsedPseudoParametersDefined in: index.ts:86
Helper function to extract parameter value from pseudo selector nodes.
Parameters
item
any
Returns
ParsedPseudoParameters
getPseudoSelectorFullText()
function getPseudoSelectorFullText(item): stringDefined in: index.ts:122
Helper function to get the full text representation of a pseudo selector including parameters
Parameters
item
Returns
string
parseBreadcrumb()
function parseBreadcrumb(query): ModifierBreadcrumbDefined in: index.ts:426
Returns an Breadcrumb list of items for a given query string.
Parameters
query
string
Returns
removeQuotes()
function removeQuotes(value): stringDefined in: index.ts:80
Helper function to remove quotes from a string value.
Parameters
value
string
Returns
string
specificitySort()
function specificitySort(breadcrumbs): ModifierBreadcrumb[]Defined in: index.ts:435
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.