The type of the metric result, defaults to MetricRaw
ProtectedconstructorCreates a new CmpStrAsync instance calliing the super constructor.
The type of the metric result, defaults to MetricRaw
Optionalopt: string | CmpStrOptions
Optional serialized or options object
ProtectedoptionsStatic ReadonlyclearClears the caches for normalizer, filter pipelines, metric, and phonetic modules.
Static ReadonlyfilterAdds, removes, pauses, resumes, lists, or clears global filters.
Static ReadonlymetricAdds, removes, checks, or lists available metrics.
Static ReadonlyphoneticAdds, removes, checks, or lists available phonetic algorithms and mappings.
Static ReadonlyprofilerProvides access to the global profiler services.
ProtectedassertProtectedassertAssert multiple conditions.
Array of [ condition, value ] pairs
Performs a batch metric comparison and returns results sorted by score.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionaldir: "desc" | "asc" = 'desc'
Sort direction (desc, asc)
Optionalopt: CmpStrOptions
Optional options
Asynchronously performs a batch metric comparison and returns results sorted by score.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionaldir: "desc" | "asc" = 'desc'
Sort direction (desc, asc)
Optionalopt: CmpStrOptions
Optional options
Performs a batch metric comparison between source and target strings or array of strings.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionalopt: CmpStrOptions
Optional options
Asynchronously performs a batch metric comparison between source and target strings or array of strings.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionalopt: CmpStrOptions
Optional options
Returns the n closest matches from a batch comparison.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionaln: number = 1
Number of closest matches
Optionalopt: CmpStrOptions
Optional options
Asynchronously returns the n closest matches from a batch comparison.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionaln: number = 1
Number of closest matches
Optionalopt: CmpStrOptions
Optional options
Performs a single metric comparison and returns only the numeric score.
The source string
The target string
Optionalopt: CmpStrOptions
Optional options
Asynchronously performs a single metric comparison returning the numeric score.
The source string
The target string
Optionalopt: CmpStrOptions
Optional options
ProtectedcomputeComputes the metric result for the given inputs, applying normalization and filtering as configured.
The type of the metric result
The first input string or array
The second input string or array
Optionalopt: CmpStrOptions
Optional options to use
Optionalmode: MetricMode
The metric mode to use
Optionalraw: boolean
Whether to return raw results
Optionalskip: boolean
Whether to skip normalization and filtering
ProtectedcomputeAsynchronously computes the metric result for the given inputs, applying normalization and filtering as configured.
The type of the metric result
The first input string or array
The second input string or array
Optionalopt: CmpStrOptions
Optional options to use
Optionalmode: MetricMode
The metric mode to use
Optionalraw: boolean
Whether to return raw results
Optionalskip: boolean
Whether to skip normalization and filtering
ProtectedfilterApplies all active filters to the input string or array.
The input string or array
Optionalhook: FilterHooks
The filter hook
ProtectedfilterAsynchronously applies all active filters to the input string or array.
The input string or array
Optionalhook: FilterHooks
The filter hook
Returns the n furthest matches from a batch comparison.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionaln: number = 1
Number of furthest matches
Optionalopt: CmpStrOptions
Optional options
Asynchronously returns the n furthest matches from a batch comparison.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionaln: number = 1
Number of furthest matches
Optionalopt: CmpStrOptions
Optional options
Returns a specific option value by path.
The path to the option
Returns the options as a JSON string.
ProtectedindexComputes the phonetic index for the given input using the specified phonetic algorithm.
The input string or array
The phonetic algorithm and options
ProtectedindexAsynchronously computes the phonetic index for the given input using the specified phonetic algorithm.
The input string or array
The phonetic algorithm and options
Performs a batch comparison and returns only results above the threshold.
The type of the metric result
The source string or array of strings
The target string or array of strings
The similarity threshold (0..1)
Optionalopt: CmpStrOptions
Optional options
Asynchronously performs a batch comparison and returns only results above the threshold.
The type of the metric result
The source string or array of strings
The target string or array of strings
The similarity threshold (0..1)
Optionalopt: CmpStrOptions
Optional options
Computes a similarity matrix for the given input array.
Only works for symmetric metrics.
The input array
Optionalopt: CmpStrOptions
Optional options
Asynchronously computes a similarity matrix for the given input array.
Only works for symmetric metrics.
The input array
Optionalopt: CmpStrOptions
Optional options
ProtectednormalizeNormalizes the input string or array using the configured or provided flags.
The input string or array
Optionalflags: string
Normalization flags
ProtectednormalizeAsynchronously normalizes the input string or array using the configured or provided flags.
The input string or array
Optionalflags: string
Normalization flags
ProtectedoutputResolves the result format (raw or formatted).
The type of the metric result
The metric result
Optionalraw: boolean
Whether to return raw results
Performs a pairwise metric comparison between source and target strings or array of strings.
Input arrays needs of the same length to perform pairwise comparison, otherwise the method will throw an error.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionalopt: CmpStrOptions
Optional options
Asynchronously performs a pairwise metric comparison between source and target strings or array of strings.
Input arrays needs of the same length to perform pairwise comparison, otherwise the method will throw an error.
The type of the metric result
The source string or array of strings
The target string or array of strings
Optionalopt: CmpStrOptions
Optional options
Computes the phonetic index for a string using the configured or given algorithm.
Optionalinput: string
The input string
Optionalalgo: string
The phonetic algorithm to use
Optionalopt: PhoneticOptions
Optional phonetic options
Asynchronously computes the phonetic index for a string using the configured or given algorithm.
Optionalinput: string
The input string
Optionalalgo: string
The phonetic algorithm to use
Optionalopt: PhoneticOptions
Optional phonetic options
ProtectedpostPost-process the results of the metric computation.
The metric result
Optionalopt: CmpStrOptionsProtectedpreparePrepares the input by normalizing and filtering.
Optionalinput: MetricInput
The input string or array
Optionalopt: CmpStrOptions
Optional options to use
ProtectedprepareAsynchronously prepares the input by normalizing and filtering.
Optionalinput: MetricInput
The input string or array
Optionalopt: CmpStrOptions
Optional options to use
Resets the instance, clearing all data and options.
ProtectedresolveResolves the options for the CmpStr instance, merging the provided options with the existing options. Validates them and throws if the options are invalid.
Optionalopt: CmpStrOptions
Optional options to merge
Removes the normalization flags entirely.
Removes an option at the given path.
The path to the option
Removes the processors entirely.
Performs a normalized and filtered substring search.
The search string
The array to search in
Optionalflags: string
Normalization flags
Optionalprocessors: CmpStrProcessors
Pre-processors to apply
Asynchronously performs a normalized and filtered substring search.
The search string
The array to search in
Optionalflags: string
Normalization flags
Optionalprocessors: CmpStrProcessors
Pre-processors to apply
Sets the normalization flags (e.g., 'itw', 'nfc').
The normalization flags
Sets the similatity metric to use (e.g., 'levenshtein', 'dice').
The metric name
Sets the pre-processors to use for preparing the input.
The processors to set
Enable or disable raw output.
Whether to enable or disable raw output
ProtectedstructuredCreates a instance for processing structured data.
The type of objects in the data array
Returns the n closest matches from a batch comparison of structured data.
The type of objects in the data array
The query string to compare against
The array of structured objects
The property key to extract for comparison
Optionaln: number = 1
Number of closest matches
Optionalopt: StructuredDataOptions
Optional lookup options
Asynchronously returns the n closest matches from a batch comparison of structured data.
The type of objects in the data array
The query string to compare against
The array of structured objects
The property key to extract for comparison
Optionaln: number = 1
Number of closest matches
Optionalopt: StructuredDataOptions
Optional lookup options
Returns the n furthest matches from a batch comparison of structured data.
The type of objects in the data array
The query string to compare against
The array of structured objects
The property key to extract for comparison
Optionaln: number = 1
Number of furthest matches
Optionalopt: StructuredDataOptions
Optional lookup options
Asynchronously returns the n furthest matches from a batch comparison of structured data.
The type of objects in the data array
The query string to compare against
The array of structured objects
The property key to extract for comparison
Optionaln: number = 1
Number of furthest matches
Optionalopt: StructuredDataOptions
Optional lookup options
Performs a batch comparison against structured data by extracting a specific property and returning results with original objects attached.
The type of objects in the data array
The query string to compare against
The array of structured objects
The property key to extract for comparison
Optionalopt: StructuredDataOptions
Optional lookup options
Asynchronously performs a batch comparison against structured data by extracting a specific property and returning results with original objects attached.
The type of objects in the data array
The query string to compare against
The array of structured objects
The property key to extract for comparison
Optionalopt: StructuredDataOptions
Optional lookup options
Performs a batch comparison and returns only results above the threshold for structured data.
The type of objects in the data array
The query string to compare against
The array of structured objects
The property key to extract for comparison
The similarity threshold (0..1)
Optionalopt: StructuredDataOptions
Optional lookup options
Asynchronously performs a batch comparison and returns only results above the threshold for structured data.
The type of objects in the data array
The query string to compare against
The array of structured objects
The property key to extract for comparison
The similarity threshold (0..1)
Optionalopt: StructuredDataOptions
Optional lookup options
Performs a pairwise comparison between two arrays of structured objects by extracting specific properties and returning results with original objects attached.
The type of objects in the arrays
The type of objects in the other array
The array of structured objects
The property key to extract for comparison
The other array of structured objects
The property key to extract from other array
Optionalopt: StructuredDataOptions
Optional lookup options
Asynchronously performs a pairwise comparison between two arrays of structured objects by extracting specific properties and returning results with original objects attached.
The type of objects in the arrays
The type of objects in the other array
The array of structured objects
The property key to extract for comparison
The other array of structured objects
The property key to extract from other array
Optionalopt: StructuredDataOptions
Optional lookup options
Performs a single metric comparison between the source and target.
The type of the metric result
The source string
The target string
Optionalopt: CmpStrOptions
Optional options
Asynchronously performs a single metric comparison.
The type of the metric result
The source string
The target string
Optionalopt: CmpStrOptions
Optional options
StaticanalyzeReturns a TextAnalyzer instance for the given input string.
Optionalinput: string
The input string
StaticcreateCreates a new CmpStrAsync instance with the given options.
Optionalopt: string | CmpStrOptions
Optional serialized or options object
StaticdiffReturns a DiffChecker instance for computing the unified diff between two texts.
The first (original) text
The second (modified) text
Optionalopt: DiffOptions
Optional diff configuration
The CmpStrAsync class provides a fully asynchronous API for string comparison, phonetic indexing, filtering and normalization.