Replace Dictionary<T> by Map<T, T> supported in es6

This commit is contained in:
rafaelsouzaf
2017-12-08 19:44:37 -03:00
parent e189cf6b5e
commit 9fb4ab18b3
10 changed files with 17 additions and 23 deletions
+4 -4
View File
@@ -61,7 +61,7 @@ export interface Request extends Podium {
* The raw request headers (references request.raw.req.headers).
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-requestheaders)
*/
readonly headers: Util.Dictionary<string>;
readonly headers: Map<string, string>;
/**
* Request information:
@@ -105,7 +105,7 @@ export interface Request extends Podium {
/**
* An object where each key is a path parameter name with matching value as described in [Path parameters](https://github.com/hapijs/hapi/blob/master/API.md#path-parameters).
*/
readonly params: Util.Dictionary<string>;
readonly params: Map<string, string>;
/**
* An array containing all the path params values in the order they appeared in the path.
@@ -131,7 +131,7 @@ export interface Request extends Podium {
/**
* An object where each key is the name assigned by a route pre-handler methods function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.
*/
readonly pre: Util.Dictionary<object>;
readonly pre: Map<string, object>;
/**
* Access: read / write (see limitations below).
@@ -142,7 +142,7 @@ export interface Request extends Podium {
/**
* Same as pre but represented as the response object created by the pre method.
*/
readonly preResponses: Util.Dictionary<object>;
readonly preResponses: Map<string, object>;
/**
* By default the object outputted from node's URL parse() method. Might also be set indirectly via request.setUrl in which case it may be a string (if url is set to an object with the query attribute as an unparsed string).
+1 -1
View File
@@ -52,7 +52,7 @@ export interface ResponseObject extends Podium {
* Note that this is an incomplete list of headers to be included with the response. Additional headers will be added once the response is prepared for transmission.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-responseheaders)
*/
readonly headers: Util.Dictionary<string | string[]>;
readonly headers: Map<string, string | string[]>;
/**
* Default value: {}.
@@ -38,7 +38,7 @@ export interface RouteOptionsPayload {
* An object where each key is a content-encoding name and each value is an object with the desired decoder settings. Note that encoder settings are set in compression.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionspayloadcompression)
*/
compression?: Util.Dictionary<PayloadCompressionDecoderSettings>;
compression?: Map<string, PayloadCompressionDecoderSettings>;
/**
* Default value: 'application/json'.
+3 -3
View File
@@ -27,7 +27,7 @@ export interface RouteOptions {
* Application-specific route configuration state. Should not be used by plugins which should use options.plugins[name] instead.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionsapp)
*/
app?: object;
app?: any;
/**
* Route authentication configuration. Value can be:
@@ -65,7 +65,7 @@ export interface RouteOptions {
* An object where each key is a content-encoding name and each value is an object with the desired encoder settings. Note that decoder settings are set in compression.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionscompression)
*/
compression?: Util.Dictionary<RouteCompressionEncoderSettings>;
compression?: Map<string, RouteCompressionEncoderSettings>;
/**
* Default value: false (no CORS headers).
@@ -180,7 +180,7 @@ export interface RouteOptions {
* Plugin-specific configuration. plugins is an object where each key is a plugin name and the value is the plugin configuration.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionsplugins)
*/
plugins?: Util.Dictionary<PluginSpecificConfiguration>;
plugins?: Map<string, PluginSpecificConfiguration>;
/**
* Default value: none.
+1 -1
View File
@@ -27,7 +27,7 @@ export interface ServerAuth {
* returned from its implementation function.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverauthapi)
*/
api: Util.Dictionary<any>;
api: Map<string, any>;
/**
* Contains the default authentication configuration is a default strategy was set via
+1 -1
View File
@@ -25,7 +25,7 @@ import * as Shot from "shot";
export interface ServerInjectOptions extends Shot.RequestOptions {
credentials?: object;
artifacts?: object;
app?: object;
app?: any;
plugins?: PluginsStates;
allowInternals?: boolean;
}
+1 -1
View File
@@ -26,7 +26,7 @@ export interface ServerOptions {
* Note the difference between server.settings.app which is used to store static configuration values and server.app which is meant for storing run-time state.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serveroptionsapp)
*/
app?: object;
app?: any;
/**
* Default value: true.
+2 -2
View File
@@ -39,7 +39,7 @@ export interface ServerState {
/**
* An array containing the names of all configued cookies.
*/
readonly names: Util.Dictionary<string>;
readonly names: string[];
/**
* Same as calling [server.state()](https://github.com/hapijs/hapi/blob/master/API.md#server.state()).
@@ -67,6 +67,6 @@ export interface ServerState {
* Note that this utility uses the server configuration but does not change the server state. It is provided for manual cookie parsing (e.g. when server parsing is disabled).
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-async-serverstatesparseheader)
*/
parse(header: string): Util.Dictionary<string>;
parse(header: string): Map<string, string>;
}
+3 -3
View File
@@ -65,7 +65,7 @@ export class Server extends Podium {
* Initialized with an empty object.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverapp)
*/
app?: object;
app?: any;
/**
* Server Auth: properties and methods
@@ -104,7 +104,7 @@ export class Server extends Podium {
*/
event(events: ServerEventsApplication): void;
event(events: ServerEventsApplication[]): void;
/**
* Access: podium public interface.
* The server events emitter. Utilizes the podium with support for event criteria validation, channels, and filters.
@@ -162,7 +162,7 @@ export class Server extends Podium {
* server method name is an object property.
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-servermethods
*/
readonly methods: Util.Dictionary<ServerMethod>;
readonly methods: Map<string, ServerMethod>;
/**
* Provides access to the server MIME database used for setting content-type information. The object must not be
-6
View File
@@ -1,11 +1,5 @@
export namespace Util {
export interface Dictionary<T> {
[key: string]: T;
}
export type HTTP_METHODS_PARTIAL_LOWERCASE = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options';
export type HTTP_METHODS_PARTIAL = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | HTTP_METHODS_PARTIAL_LOWERCASE;
export type HTTP_METHODS = 'HEAD' | 'head' | HTTP_METHODS_PARTIAL;
}