/** * The MIT License (MIT) * * Copyright (c) 2016-2019 John Jeremy Leider * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * Originally copied from Vuetify package * (https://github.com/vuetifyjs/vuetify/blob/v1.5.16/packages/vuetify/src/util/mask.ts) */ export interface MaskItem { test: (char: string) => boolean; convert?: (char: string) => string; } export declare type MaskType = '#' | 'A' | 'a' | 'C' | 'N' | 'n' | 'X'; /** * Base class control mask on text */ export declare class Mask { /** * Mask patterns */ static patterns: any; /** * Add a new mask pattern * @param pattern pattern character * @param testExp regular expression * @param forceCase force upper case or lower case */ static addPattern(pattern: string, testExp: any, forceCase?: 'uppercase' | 'lowercase'): void; /** * Mask delimiters */ private static defaultDelimiters; /** * Allowed mask patterns */ private static allowedMasks; /** * Checks is a mask delimiter * @param char Mask character */ static isMaskDelimiter(char: string): boolean; /** * Checks is a valid mask character * @param char Mask character */ private static isMask; /** * Applies mask rules on char value * @param mask Mask character * @param char Text character */ private static convert; /** * Applies mask rules to value * @param mask Mask * @param text Text value */ static convertAll(mask: string | any[], text: string | null): string; /** * Checks is a valid char based on mask types * @param mask Mask character * @param char Text character * @returns Is valid */ private static maskValidates; /** * Retrieves a value with mask * @param text Value to apply mask * @param masked Mask pattern * @param dontFillMaskBlanks Should keep invalid mask on value */ static getValueWithMask(text: string | null | undefined, masked: string | any[], dontFillMaskBlanks?: boolean): string; /** * Retrieves a value without mask * @param text Value with mask */ static getValueWithoutMask(text: string): string; /** * Checks if text matches the mask * @param text Text being checked * @param mask Test mask */ static checkMask(text: string | null | undefined, mask: string | any[]): boolean; /** * Transforms the mask to an array of regexp * @param mask The mask */ static getMaskArray(mask: string | any[]): any[]; }