Returns the enabled state.s
Returns the length of the validators array.
Provides an iterator for validators.
Rest
...validators: (ValidatorFn | ValidatorData)[]Rest
...validators: (ValidatorFn | ValidatorData)[]Remove validators by the provided callback. The callback takes 3 parameters: id
, validator
, and weight
.
Any truthy value returned will remove that validator.
Callback function to evaluate each validator entry.
Provides the storage and sequencing of managed position validators. Each validator added may be a bespoke function or a ValidatorData object containing an
id
,validator
, andweight
attributes;validator
is the only required attribute.The
id
attribute can be anything that creates a unique ID for the validator; recommended strings or numbers. This allows validators to be removed by ID easily.The
weight
attribute is a number between 0 and 1 inclusive that allows validators to be added in a predictable order which is especially handy if they are manipulated at runtime. A lower weighted validator always runs before a higher weighted validator. If no weight is specified the default of '1' is assigned and it is appended to the end of the validators list.This class forms the public API which is accessible from the
.validators
getter in the main TJSPosition instance.