File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
The MIT License (MIT)
2
2
3
- Copyright (c) 2015 Tom Spencer.
3
+ Copyright (c) 2015-2020 Tom Spencer.
4
4
5
5
Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
of 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
19
19
Add as a piece of express middleware, before defining your routes.
20
20
21
21
``` 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' );
25
25
26
- var app = express ();
26
+ const app = express ();
27
27
28
28
app .use (bodyParser .urlencoded ({extended: true }));
29
29
app .use (bodyParser .json ());
@@ -41,9 +41,9 @@ app.use(mongoSanitize({
41
41
You can also bypass the middleware and use the module directly:
42
42
43
43
``` js
44
- var mongoSanitize = require (' express-mongo-sanitize' );
44
+ const mongoSanitize = require (' express-mongo-sanitize' );
45
45
46
- var payload = {... };
46
+ const payload = {... };
47
47
48
48
// Remove any keys containing prohibited characters
49
49
mongoSanitize .sanitize (payload);
@@ -54,7 +54,7 @@ mongoSanitize.sanitize(payload, {
54
54
});
55
55
56
56
// Check if the payload has keys with prohibited characters
57
- var hasProhibited = mongoSanitize .has (payload);
57
+ const hasProhibited = mongoSanitize .has (payload);
58
58
```
59
59
60
60
## What?
You can’t perform that action at this time.
0 commit comments