/
function.ts
35 lines (28 loc) · 887 Bytes
/
function.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import Masked, { type MaskedOptions } from './base';
import IMask from '../core/holder';
export
type MaskedFunctionOptions = MaskedOptions<MaskedFunction>;
/** Masking by custom Function */
export default
class MaskedFunction<Value=any> extends Masked<Value> {
/** */
declare mask: (value: string, masked: Masked) => boolean;
/** Enable characters overwriting */
declare overwrite?: boolean | 'shift' | undefined;
/** */
declare eager?: boolean | 'remove' | 'append' | undefined;
/** */
declare skipInvalid?: boolean | undefined;
/** */
declare autofix?: boolean | 'pad' | undefined;
override updateOptions (opts: Partial<MaskedFunctionOptions>) {
super.updateOptions(opts);
}
override _update (opts: Partial<MaskedFunctionOptions>) {
super._update({
...opts,
validate: opts.mask,
});
}
}
IMask.MaskedFunction = MaskedFunction;