Invokable
A validation function that will be invoked at some time
Constructor Summary
| Public Constructor | ||
| public |
constructor(fn: Function, name: String, args: Array, memoize: Boolean) |
|
Member Summary
| Private Members | ||
| private |
_args: * |
|
| private |
_fn: * |
|
| private |
_memoize: * |
|
| private |
_memoizedFn: * |
|
| private |
_name: * |
|
Method Summary
| Public Methods | ||
| public |
Remove the |
|
| public |
invoke(subject: Any): Boolean Executes a validation function against a subject and any predefined arguments |
|
| public |
memoize() Create a private, non-enumerable and non-writable |
|
| public |
serialize(): String Represent an Invokable as a string. |
|
Public Constructors
public constructor(fn: Function, name: String, args: Array, memoize: Boolean) source
Params:
| Name | Type | Attribute | Description |
| fn | Function | [required] function reference that is executed during invokation |
|
| name | String | [required] required if function is anonymous will override function name property |
|
| args | Array | [optional] arguments to be applied to the function |
|
| memoize | Boolean | [optional] when true, function calls are memoized |
Private Members
private _args: * source
private _fn: * source
private _memoize: * source
private _memoizedFn: * source
private _name: * source
Public Methods
public dememoize() source
Remove the _cache property and _memoizedFn. Set _memoize to false
so that _fn is called.
public invoke(subject: Any): Boolean source
Executes a validation function against a subject and any predefined arguments
Params:
| Name | Type | Attribute | Description |
| subject | Any | the value to be validated |
Return:
| Boolean | the result of the validation |
public memoize() source
Create a private, non-enumerable and non-writable _cache property, as well
as a _memoizedFn property. Calling an Invokable's _memoizedFn rather
than its _fn will cause the result to be stored in the _cache, keyed by
the function arguments.
public serialize(): String source
Represent an Invokable as a string.
Return:
| String | a stringified JSON blob representing an
|