File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 11The MIT License (MIT)
22
3- Copyright (c) 2015 Tom Spencer.
3+ Copyright (c) 2015-2020 Tom Spencer.
44
55Permission is hereby granted, free of charge, to any person obtaining a copy
66of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ npm install express-mongo-sanitize
1919Add as a piece of express middleware, before defining your routes.
2020
2121``` js
22- var express = require (' express' ),
23- bodyParser = require (' body-parser' ),
24- mongoSanitize = require (' express-mongo-sanitize' );
22+ const express = require (' express' );
23+ const bodyParser = require (' body-parser' );
24+ const mongoSanitize = require (' express-mongo-sanitize' );
2525
26- var app = express ();
26+ const app = express ();
2727
2828app .use (bodyParser .urlencoded ({extended: true }));
2929app .use (bodyParser .json ());
@@ -41,9 +41,9 @@ app.use(mongoSanitize({
4141You can also bypass the middleware and use the module directly:
4242
4343``` js
44- var mongoSanitize = require (' express-mongo-sanitize' );
44+ const mongoSanitize = require (' express-mongo-sanitize' );
4545
46- var payload = {... };
46+ const payload = {... };
4747
4848// Remove any keys containing prohibited characters
4949mongoSanitize .sanitize (payload);
@@ -54,7 +54,7 @@ mongoSanitize.sanitize(payload, {
5454});
5555
5656// Check if the payload has keys with prohibited characters
57- var hasProhibited = mongoSanitize .has (payload);
57+ const hasProhibited = mongoSanitize .has (payload);
5858```
5959
6060## What?
You can’t perform that action at this time.
0 commit comments