파일 이름 변경 내용에 접미사 추가

This commit is contained in:
2026-05-22 08:02:51 +09:00
parent f3193672c6
commit 77bc2815a3
7 changed files with 23 additions and 9 deletions
+6 -3
View File
@@ -7,14 +7,17 @@ export function clampDigits(value, fallback = 3) {
return Math.max(1, Math.min(6, parseInt(value, 10) || fallback));
}
export function buildSequentialName(fileName, index, { prefix, digits }) {
export function buildSequentialName(fileName, index, { prefix, digits, postfix = '' }) {
const ext = getExtension(fileName);
return `${prefix}_${String(index + 1).padStart(digits, '0')}.${ext}`;
const sequence = `${prefix}_${String(index + 1).padStart(digits, '0')}`;
const suffix = postfix ? `_${postfix}` : '';
return `${sequence}${suffix}.${ext}`;
}
export function getNameFormat(prefixInput, digitsInput, digitsFallback = 3) {
export function getNameFormat(prefixInput, digitsInput, digitsFallback = 3, postfixInput = null) {
return {
prefix: prefixInput.value.trim() || 'photo',
digits: clampDigits(digitsInput.value, digitsFallback),
postfix: postfixInput?.value.trim() || '',
};
}