UNPKG

@daks.dev/svelte.sdk

Version:
31 lines (30 loc) 782 B
export const imageExtnames = [ '.heic', '.heif', '.avif', '.jpeg', '.jpg', '.png', '.tiff', '.webp', '.gif' ]; export const imagePattern = `(${imageExtnames.map((val) => val.substring(1)).join('|')})`; export function globIndex(data) { return Object.keys(data).map((val) => val.replace(/.+\/(.+)/g, '$1')); } export function globInfoset(idxs, data) { return idxs.reduce((res, key) => (Object.values(data).forEach((val) => (res[key] = { ...res[key], ...val[key] })), res), {}); } export function globDataset(idxs, captions, metas) { const data = Object.values(metas); return idxs.reduce((res, key, idx) => ((res[idx] = { ...data[idx], ...captions[key] }), res), Array(0)); }