mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
27 lines
536 B
TypeScript
27 lines
536 B
TypeScript
import express = require('express');
|
|
import mongoSanitize = require('express-mongo-sanitize');
|
|
|
|
const app: express.Express = express();
|
|
|
|
app.use(mongoSanitize());
|
|
|
|
app.use(mongoSanitize({
|
|
replaceWith: '_'
|
|
}));
|
|
|
|
interface TestPayload {
|
|
foo: string;
|
|
}
|
|
|
|
const testPayload: TestPayload = {
|
|
foo: 'bar'
|
|
};
|
|
|
|
const sanitize1: TestPayload = mongoSanitize.sanitize(testPayload);
|
|
|
|
const sanitize2: TestPayload = mongoSanitize.sanitize(testPayload, {
|
|
replaceWith: '_'
|
|
});
|
|
|
|
const isCorrect: boolean = mongoSanitize.has(testPayload);
|