Instantiates a StringMatchSort object.
Optional
defaultTransformations: StringTransformationFunction[]Transformation functions to apply to all strings. If a rank function is not successful, it will try again with the transformations applied both to the search term and to the value. It will first try only with the first transformations, then with the first and second together, and so on. The more transformations necessary, the greater the resulting rank number will be.
Private
Readonly
defaultPrivate
indexedChains a new rank function to the sorting algorithm.
The rank function to chain.
Optional
transformations: StringTransformationFunction[]Transformation functions to apply to the rank function. If not provided, the default transformations will be used.
MatchSort.chain
Generates a MatchSort object that applies the sorting algorithm to a two-dimensional array, where the best ranking item in each list is used in the final algorithm. This can be used to sort lists of items with multiple searchable keywords.
The generated MatchSort object.
Generates a MatchSort object that applies the sorting algorithm to the given property of the values.
The key of the property that holds the value to sort by.
The generated MatchSort object.
Sets the filter function.
The filter function.
Optional
transformations: StringTransformationFunction[]Transformation functions to apply to the filter function. If not provided, the default transformations will be used. The filter function will apply all transformations at once to both the search term and the value before filtering.
The StringMatchSort object.
Runs the sorting algorithm on the given values.
The search term.
The values to sort.
The sorted values.
The result is cached, so that if the search term starts with the previous search term, the previous result is used as the input to the sort function. This applies as long as the given values array is the same object.
Static
fromInstantiates a StringMatchSort object from a single rank function.
The rank function.
Optional
transformations: StringTransformationFunction[]Transformation functions to apply to the rank function.
The StringMatchSort object.
Generated using TypeDoc
A class that allows to build and run a sorting algorithm on a list of strings.