export const sanitizePath = (path) => path.replace(/\s/g, "-").toLowerCase();
export const getLastIndexFromPath = (nodes, name, parentFolder) => {
    const regexp = new RegExp(`^${name}(\\s\\d+)?$`, "i");
    const filteredNodes = nodes
        .filter((node) => node.parentFolder == parentFolder && regexp.test(node.name))
        .map((node) => {
        const index = /(\d+)?$/i.exec(node.name);
        if (index)
            return Number(index[0]);
        return 0;
    })
        .sort((a, b) => a - b);
    if (!filteredNodes || filteredNodes.length === 0)
        return null;
    return filteredNodes[filteredNodes.length - 1];
};
//# sourceMappingURL=path.js.map