mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Created host-validation typings. * Fixed tsconfig.json. * Added strictFunctionTypes to true in tsconfig.json. * Changed T[] to Array<T> because it is non-simple type. * Added optional parameters. * Added more tests. * trailing whitespace fix * Fixed Spelling. * Change hosts parameter to opts. * Changed import in test, and added namespace.
22 lines
720 B
TypeScript
22 lines
720 B
TypeScript
// Type definitions for host-validation 2.0
|
|
// Project: https://github.com/brannondorsey/host-validation
|
|
// Definitions by: Rich Liu <https://github.com/dintopple>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.8
|
|
|
|
import { Request, Response, NextFunction } from 'express';
|
|
|
|
declare namespace hostValidation {
|
|
interface config {
|
|
hosts?: Array<string|RegExp>;
|
|
referers?: Array<string|RegExp>;
|
|
mode?: 'both' | 'either';
|
|
fail?(req: Request, res: Response, next: NextFunction): void;
|
|
}
|
|
}
|
|
|
|
declare function hostValidation(opts: hostValidation.config):
|
|
(req: Request, res: Response, next: NextFunction) => void;
|
|
|
|
export = hostValidation;
|