Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-image-placeholder

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-image-placeholder - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

2

dev.js

@@ -15,4 +15,4 @@ /**

app.use('/image/', ImagePlaceholder);
app.use('/:width(\\d+)x:height(\\d+)', ImagePlaceholder);
app.listen(PORT, () => console.log(`Dev server running on port ${PORT}!`))

@@ -5,3 +5,3 @@ /**

const { createCanvas } = require('canvas');
const Express = require('express');
const HttpError = require('http-errors');

@@ -20,8 +20,6 @@ /**

const router = Express.Router();
router.get('/:width(\\d+)x:height(\\d+)', (req, res, next) => {
module.exports = (req, res, next) => {
const { height, width } = Utils.parseUrlParams(req.params);
if (!Number.isInteger(height) || !Number.isInteger(width)) {
throw new Error(`Width and height must be integers.`);
return next(new HttpError.BadRequest());
}

@@ -47,3 +45,3 @@

if (!colorPalette) {
throw new Error(`Color palette '${color}' not found.`);
return next(new HttpError.BadRequest());
}

@@ -122,6 +120,4 @@

default:
throw new Error(`Unknown image format provided.`);
return next(new HttpError.BadRequest());
}
});
module.exports = router;
};
{
"name": "express-image-placeholder",
"version": "2.0.0",
"version": "3.0.0",
"description": "Express router-level middleware for delivering simple test images.",

@@ -26,5 +26,8 @@ "main": "index.js",

"dependencies": {
"canvas": "2.0.0-alpha.12",
"express": "^4.16.3"
"canvas": "2.1.x",
"http-errors": "1.7.x"
},
"devDependencies": {
"express": "^4.16.4"
}
}
# express-image-placeholder
Express router-level middleware for delivering simple test images. Only dependencies are `canvas` and `express`.
Express middleware for delivering simple test images. Only dependencies are `canvas` and `express`.
## Usage
Only required attributes are `height` and `width`. The ayre part of the route.
Only required attributes are `height` and `width`. The are part of the route.

@@ -24,3 +24,3 @@ `<your path>/:width(\d+)x:height(\d+)`

app.use('/image/', ImagePlaceholder);
app.use('/image/:width(\\d+)x:height(\\d+)', ImagePlaceholder);
```

@@ -27,0 +27,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc