export function formatPicture(picture) {
    if (typeof picture === 'string') picture = picture.split(',');
    if (!picture || !Array.isArray(picture)) return [];
    return picture.filter(Boolean).map(url => /https?/.test(url) ? url : `${process.env.VUE_APP_UPLOAD}file/${url}`);
}

export function toPicture(picture) {
    if (typeof picture === 'string') picture = picture.split(',');
    if (!picture || !Array.isArray(picture)) return [];
    const r = new RegExp(`^${process.env.VUE_APP_UPLOAD}file/`)
    return picture.map(url => url.replace(r, '')).filter(Boolean).join(',');
}