External module "util/createVerifiableClass"
Type aliases
ES5Entity
ES5Entity: object
Type declaration
-
Optional _check?: function
-
Optional getDisplayName?: function
-
Optional getInitialOptions?: function
-
Optional getInitialRule?: function
-
Optional getRuleString?: Function
-
Optional getTypeName?: Function
-
Optional toString?: Function
Functions
createVerifiableClass
- createVerifiableClass<Result, Rule, Options>(entity?: ES5Entity, __namedParameters?: object): function
-
Type parameters
Parameters
-
Default value entity: ES5Entity = {}
-
Default value __namedParameters: object = {}
Returns function
-
- (rule?: Rule, options?: Options): Result
-
Parameters
-
Optional rule: Rule
-
Optional options: Options
Returns Result
Creates a verifiable Class.
const age = createVerifiableClass({ _check(req) { return integer._check(req) }, getDisplayName() { return 'Age' }, getInitialRule() { return null }, getInitialOptions() { return null } }) age().ok(22) === true age().ok('22') === false age().getTypeName() === 'Age' age().toString() === 'Age()' // es6 inheritance class Age extends Verifiable { _check() { return integer._check(req) } static displayName = 'Age' constructor(rule, options) { super(rule, options) this.rule = null this.options = null } } const age = funcify(Age) const age() instanceof Age // true new Age() instanceof Age // true constructify(age) === Age // true