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

dat-middleware

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dat-middleware - npm Package Compare versions

Comparing version 1.5.7 to 1.5.8

lib/log.js

1

index.js

@@ -14,2 +14,3 @@ var RequestData = require('./lib/RequestData');

mw.params = require('./lib/params');
mw.log = require('./lib/log');
mw.errorHandler= require('./lib/errorHandler');

25

lib/res.js

@@ -1,26 +0,3 @@

var isString = require('101/is-string');
var exists = require('101/exists');
var keypather = require('keypather')();
var replaceKeypaths = require('./utils/replaceKeypaths');
function replaceKeypaths (req, args, dontReplace) {
return args.map(function (arg) {
var kpArgs;
if (isString(arg)) {
kpArgs = [arg];
}
else if (Array.isArray(arg)) {
kpArgs = arg;
}
else {
return arg;
}
if (!dontReplace && kpArgs.length>1) {
kpArgs = [kpArgs[0]].concat(replaceKeypaths(req, kpArgs.slice(1), true));
}
kpArgs = [req].concat(kpArgs);
var keypathVal = keypather.get.apply(keypather, kpArgs);
return exists(keypathVal) ? keypathVal : arg;
});
}
var endMethods = ['send', 'json', 'end', 'redirect'];

@@ -27,0 +4,0 @@ function middlewarizeResMethod (method) {

{
"name": "dat-middleware",
"version": "1.5.7",
"version": "1.5.8",
"description": "common request, response, body, query, and param validation, transformation, and flow control middleware",

@@ -50,4 +50,5 @@ "main": "index.js",

"fn-object": "^0.2.1",
"clone": "^0.1.11"
"clone": "^0.1.11",
"function-proxy": "~0.5.1"
}
}
var express = require('express');
var mw = require('../../index');
var next = function (req, res, next) {next();}
module.exports = function createAppWithMiddleware (middleware, middleware2) {
middleware2 = middleware2 || function (req, res, next) {next();};
module.exports = function createAppWithMiddleware (middleware, middleware2, middleware3) {
middleware2 = middleware2 || next;
middleware3 = middleware3 || next;
var app = express();

@@ -13,3 +15,4 @@ app.use(express.json());

middleware,
middleware2);
middleware2,
middleware3);
app.all('/body',

@@ -16,0 +19,0 @@ // inspect,

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