INNER CODE UNIT · JavaScript
buildImageTargets
timothystewart6/techno-tim.github.io · tools/lquip/index.js:28
function buildImageTargets(files) {
const imageMap = new Map();
for (const file of files) {
const extension = path.extname(file).toLowerCase();
const baseName = file.slice(0, -extension.length);
if (!imageMap.has(baseName)) {
imageMap.set(baseName, new Map());
}
imageMap.get(baseName).set(extension, file);
}
return Array.from(imageMap.entries())
.sort(([left], [right]) => left.localeCompare(right))
.map(([, variants]) => {
const inputPath = preferredInputExtensions