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

celebrate

Package Overview
Dependencies
Maintainers
2
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 7.0.0 to 7.0.1

17

lib/index.js

@@ -9,3 +9,3 @@ 'use strict';

const validations = require('./schema');
const isCelebrate = Symbol('isCelebrate');
const CELEBRATED = Symbol('isCelebrate');
const DEFAULTS = {

@@ -38,3 +38,3 @@ escapeHtml: true

if (err) {
err[isCelebrate] = true;
err[CELEBRATED] = true;
err._meta = { source };

@@ -53,2 +53,9 @@ return next(err);

const isCelebrate = (err) => {
if (err != null && typeof err === 'object') { // eslint-disable-line eqeqeq
return err[CELEBRATED] || false;
}
return false;
};
const celebrate = (schema, options) => {

@@ -91,3 +98,3 @@ const result = Joi.validate(schema || {}, validations.schema);

return (err, req, res, next) => {
if (err[isCelebrate]) {
if (isCelebrate(err)) {
const error = {

@@ -118,7 +125,7 @@ statusCode: 400,

module.exports = {
celebrate,
Joi,
errors
errors,
isCelebrate
};
{
"name": "celebrate",
"version": "7.0.0",
"version": "7.0.1",
"description": "A joi validation middleware for Express.",

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

@@ -86,2 +86,8 @@ ![Celebrate](https://github.com/continuationlabs/celebrate/raw/master/images/logo.png)

### `isCelebrate(err)`
Returns `true` if the provided `err` object originated from the `celebrate` middleware, and `false` otherwise. Useful if you want to write your own error handler for `celebrate` errors.
- `err` - an error object
## Order

@@ -88,0 +94,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