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

celebrate

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

celebrate - npm Package Compare versions

Comparing version 14.0.0 to 15.0.0

3

lib/celebrate.js

@@ -192,2 +192,3 @@ const HTTP = require('http');

statusCode,
message,
} = finalOpts;

@@ -208,3 +209,3 @@

error: HTTP.STATUS_CODES[statusCode],
message: err.message,
message: message || err.message,
validation,

@@ -211,0 +212,0 @@ };

@@ -17,3 +17,3 @@ /* eslint-disable max-classes-per-file */

exports.CelebrateError = class extends Error {
constructor(message = 'celebrate request validation failed', opts = {}) {
constructor(message = 'Validation failed', opts = {}) {
super(message);

@@ -20,0 +20,0 @@ this.details = new internals.Details();

@@ -45,2 +45,3 @@ const HTTP = require('http');

statusCode: Joi.number().integer().valid(...validStatusCodes),
message: Joi.string(),
});
{
"name": "celebrate",
"version": "14.0.0",
"version": "15.0.0",
"description": "A joi validation middleware for Express.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -39,4 +39,2 @@ [![celebrate](https://github.com/arb/celebrate/raw/master/images/logo.svg?sanitize=1)](https://www.npmjs.org/package/celebrate)

Wondering why *another* joi middleware library for express? Full blog post [here](https://medium.com/@adambretz/time-to-celebrate-27ccfc656d7f).
<!-- toc -->

@@ -191,2 +189,3 @@

- `statusCode` - `number` that will be used for the response status code in the event of an error. Must be greater than 399 and less than 600. It must also be a number available to the node [HTTP module](https://nodejs.org/api/http.html#http_http_status_codes). Defaults to 400.
- `message` - `string` that will be used for the `message` value sent out by the error handler. Defaults to `'Validation failed'`

@@ -226,5 +225,5 @@ If the error response format does not suite your needs, you are encouraged to write your own and check [`isCelebrateError(err)`](#iscelebrateerrorerr) to format celebrate errors to your liking.

Creates a new `CelebrateError` object.
Creates a new `CelebrateError` object. Extends the built in `Error` object.
- `message` - optional `string` message. Defaults to `'celebrate request validation failed'`
- `message` - optional `string` message. Defaults to `'Validation failed'`.
- `[opts]` - optional `object` with the following keys

@@ -278,2 +277,2 @@ - `celebrated` - `bool` that, when `true`, adds `Symbol('celebrated'): true` to the result object. This indicates this error as originating from `celebrate`. You'd likely want to set this to `true` if you want the celebrate error handler to handle errors originating from the `format` function that you call in user-land code. Defaults to `false`.

*Before* opening issues on this repo, make sure your joi schema is correct and working as you intended. The bulk of this code is just exposing the joi API as express middleware. All of the heavy lifting still happens inside joi. You can go [here](https://npm.runkit.com/joi) to verify your joi schema easily.
*Before* opening issues on this repo, make sure your joi schema is correct and working as you intended. The bulk of this code is just exposing the joi API as express middleware. All of the heavy lifting still happens inside joi. You can go [here](https://npm.runkit.com/joi) to verify your joi schema easily.

Sorry, the diff of this file is not supported yet

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