2
0
mirror of https://github.com/tenrok/maska.git synced 2026-06-05 16:42:28 +03:00

chore: fix lint warnings

This commit is contained in:
Alexander Shabunevich
2024-04-11 21:30:28 +03:00
parent 7273dc73a4
commit 7159eb3460
2 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -6,14 +6,14 @@ type MaskaDirective = Directive<HTMLElement, MaskInputOptions | undefined>
const masks = new WeakMap<HTMLInputElement, MaskInput>()
// hacky way to update binding.arg without using defineExposed
const setArg = (binding: DirectiveBinding, value: string | boolean) => {
if (!binding.arg || (binding.instance == null)) return
const setArg = (binding: DirectiveBinding, value: string | boolean): void => {
if (binding.arg == null || (binding.instance == null)) return
const inst = binding.instance as any
if (binding.arg in inst) {
inst[binding.arg] = value // options api
} else if (inst.$?.setupState && binding.arg in inst.$.setupState) {
} else if (inst.$?.setupState != null && binding.arg in inst.$.setupState) {
inst.$.setupState[binding.arg] = value // composition api
}
}
@@ -24,8 +24,8 @@ export const vMaska: MaskaDirective = (el, binding) => {
if (input == null || input?.type === 'file') return
if (binding.arg) {
const updateArg = (detail: MaskaDetail) => {
if (binding.arg != null) {
const updateArg = (detail: MaskaDetail): void => {
const value = binding.modifiers.unmasked
? detail.unmasked
: binding.modifiers.completed
+3 -3
View File
@@ -31,8 +31,8 @@ export class MaskInput {
this.init(Array.from(this.items.keys()), needUpdate)
}
updateValue (input: HTMLInputElement) {
if (input.value && input.value !== this.processInput(input).masked) {
updateValue (input: HTMLInputElement): void {
if (input.value !== '' && input.value !== this.processInput(input).masked) {
this.setValue(input, input.value)
}
}
@@ -97,7 +97,7 @@ export class MaskInput {
this.fixCursor(input, isDelete, () => this.setValue(input, value))
}
private fixCursor (input: HTMLInputElement, isDelete: boolean, closure: any) {
private fixCursor (input: HTMLInputElement, isDelete: boolean, closure: CallableFunction): void {
const pos = input.selectionStart
const value = input.value