auto-hyphen-utils
Version:
This module provides automatic formatting and hyphenation for structured inputs with a similar pattern.
37 lines (32 loc) • 1.44 kB
text/typescript
/**
* @name 전화번호에 하이픈을 자동으로 추가하는 함수
* @description 010-123-1234 및 010-1234-1234 형식 지원
*
* @param {string} value - 문자열
* @returns {string} - 하이픈이 추가된 문자열
*/
declare function autoHyphenPhoneNumber(value?: string): string;
/**
* @name 사업자번호에 하이픈을 자동으로 추가하는 함수
* @description 10자리 또는 13자리 사업자번호 지원
*
* @param {string} value - 문자열
* @returns {string} - 하이픈이 추가된 문자열
*/
declare function autoHyphenTinNumber(value?: string): string;
/**
* @name 지정된 패턴에 따라 입력 값에 하이픈을 자동으로 추가하는 함수
*
* @param {string} value - 포맷할 입력 문자열입니다.
* @param {Array<number>} pattern - 하이픈 삽입 위치를 지정하는 배열입니다. 기본값은 `[3, 4, 4]`
* @returns {string} - 하이픈이 추가된 문자열을 반환합니다.
* - 유효하지 않은 입력값이 주어진 경우 빈 문자열 (`""`)을 반환합니다.
* - `pattern`이 유효하지 않은 경우, 숫자 문자열을 그대로 반환합니다.
*/
declare function commonAutoHyphen(value?: string, pattern?: number[]): string;
declare const autoHyphen: {
common: typeof commonAutoHyphen;
phoneNumber: typeof autoHyphenPhoneNumber;
tinNumber: typeof autoHyphenTinNumber;
};
export { autoHyphen as default };