"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.truncateString = void 0;
const findExtension_1 = require("../findExtension");
const constants_1 = require("./constants");
const truncateString = (fileName) => {
    const fileExtension = (0, findExtension_1.findExtension)(fileName);
    if (fileExtension && fileName.endsWith(fileExtension)) {
        const baseName = fileName.slice(0, fileName.length - fileExtension.length - constants_1.SUFFIX_LENGTH);
        const suffixWithExtension = fileName.slice(-fileExtension.length - constants_1.SUFFIX_LENGTH);
        return { baseName, suffixWithExtension };
    }
    const baseName = fileName.slice(0, -constants_1.SUFFIX_LENGTH);
    const suffixWithExtension = fileName.slice(-constants_1.SUFFIX_LENGTH);
    return { baseName, suffixWithExtension };
};
exports.truncateString = truncateString;
