Sets up a function to lazy load the configuration when any of the other functions are called.
Services accessor. Note: Not passed into the constructor because this object should be created before ValidationServices itself. So it gets assigned when the associated service property on ValidationService is assigned the service instance.
Provides access to services.
Protected
loggerProvides an API for logging, sending entries to the loggerService.
Protected
preProtected
indexUtility for register() to identify an already registered item that can be replaced by the supplied item.
an index into the getAll collection of a match or -1 if no match.
Compares two values, determining if they are equal, less than, or greater than each other.
This function is designed to handle a wide range of data types, offering flexibility in comparison strategies based on the type and content of the values provided. It supports basic types directly and offers a mechanism for comparing custom data types through converters and comparers.
When using data types that you know don't naturally work with the above, we recommend running them through the DataTypeConversionService first to change their data type and lookup key to something that does.
let convertedResult = services.dataTypeConverterService.convert(value, LookupKey.Integer);
if (convertedResult.failed)
return ComparisonResult.Undetermined;
let comparisonResult = services.dataTypeComparerService.compare(convertedResult.value, 5, LookupKey.Integer, null);
Many Condition objects use this compare() function, such as RangeCondition, EqualToValueCondition, etc. They have these properties on their Config objects to provide conversion prior to comparision:
Some good examples of using conversionLookupKey and secondConversionLookupKey are:
Comparison is performed as follows:
The first value to compare.
The second value to compare.
A lookup key indicating how to interpret value1
or null if no such hint is needed.
A lookup key indicating how to interpret value2
or null if no such hint is needed.
The result of the comparison. The ComparersResult enum has these values: Equal, NotEqual, LessThan, GreaterThan, Undetermined. Expect booleans to report Equal or NotEqual, and other types to report Equals, LessThan, or GreaterThan. Expect Undetermined when types are mismatched or unsupported.
Protected
logReturns a comparer that supports both values or null if not. Runs the lazyloader if setup and the first search fails.
Protected
updateChanges the services on all implementations of IServicesAccessor
Registers an instance of the interface supported by this service. It may replace an existing one, as determined by the subclass. Replace supported on: IDataTypeIdentifier
Protected
unregisterReturns the full collection.
Protected
ensureProtected
logProtected
hasGenerated using TypeDoc v0.25.12
A service for changing the comparing two values using IDataTypeComparer instances.
Used by Conditions to compare two values when those values don't naturally work with the JavaScript comparison operators. Due to the Converter's ability to prepare most values for the default comparison function, these aren't often created.
This class is available on ValidationServices.dataTypeComparerService.