@mapbox/appropriate-images
Advanced tools
Comparing version 4.1.0-beta.5 to 4.1.0-beta.6
'use strict'; | ||
const _ = require('lodash'); | ||
const pify = require('pify'); | ||
const fs = require('fs'); | ||
const fs = require('fs').promises; | ||
const imagemin = require('imagemin'); | ||
@@ -19,9 +18,12 @@ const imageminPngquant = require('imagemin-pngquant'); | ||
async function writeOptimizedImages(imageData) { | ||
return Promise.all( | ||
imageData.map((item) => | ||
pify(fs.writeFile)(item.destinationPath, item.data).then( | ||
() => item.destinationPath | ||
) | ||
) | ||
); | ||
let destinationPaths = []; | ||
for (const item of imageData) { | ||
try { | ||
await fs.writeFile(item.destinationPath, item.data); | ||
destinationPaths.push(item.destinationPath); | ||
} catch (error) { | ||
throw new Error(error); | ||
} | ||
} | ||
return destinationPaths; | ||
} | ||
@@ -28,0 +30,0 @@ |
{ | ||
"name": "@mapbox/appropriate-images", | ||
"version": "4.1.0-beta.5", | ||
"version": "4.1.0-beta.6", | ||
"description": "Get appropriately sized images into your website.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2083381
836