getErrors()
Returns the object of set errors
RangeErrors.prototype.getErrors()
RangeErrors.prototype.getErrors()
Returns an object
of set range errors, where the key is a unique identification.
public getErrors(): { [Key in Id]: RangeError<Key> | undefined } {
return Object.fromEntries(this.errors.entries()) as any;
}
Return type
The return type is an object of the RangeError
objects or undefined
in the keys of generic type variable Id
.
Returns
The return value is an object
of set errors.
Example usage
// Example usage.
import { RangeErrors } from '@angular-package/error';
// Define range errors.
const rangeErrors = new RangeErrors('RE: 4332', 'RE: 4331', 'RE: 4330');
// Set the `RangeError` objects under the given identification numbers.
rangeErrors
.set(
'Age is 99',
'Age must be',
'RE: 4330',
9,
27
)
.set('Detected numbers', 'Provide only letters', 'RE: 4331');
/*
Returns
{
RE: 4330: ...,
RE: 4331: ...
}
of type
{
"RE: 4332": RangeError<"RE: 4332", undefined, undefined> | undefined;
"RE: 4331": RangeError<"RE: 4331", undefined, undefined> | undefined;
"RE: 4330": RangeError<"RE: 4330", undefined, undefined> | undefined;
}
*/
rangeErrors.getErrors();
Last updated
Was this helpful?