Skip to content

Commit b6b4ba1

Browse files
committed
chore: Renamed type.
1 parent 45990b8 commit b6b4ba1

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/llhttp/c-headers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class CHeaders {
6464
return res;
6565
}
6666

67-
private buildEnum(name: string, prefix: string, map: constants.Enum,
67+
private buildEnum(name: string, prefix: string, map: constants.IntDict,
6868
encoding: Encoding = 'none'): string {
6969
let res = '';
7070

@@ -92,7 +92,7 @@ export class CHeaders {
9292
return res;
9393
}
9494

95-
private buildMap(name: string, map: constants.Enum): string {
95+
private buildMap(name: string, map: constants.IntDict): string {
9696
let res = '';
9797

9898
res += `#define ${name}_MAP(XX) \\\n`;

src/llhttp/constants.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { enumToMap } from './utils';
22

3-
export type Enum = Record<string, number>;
3+
export type IntDict = Record<string, number>;
44

55
// Emums
66

7-
export const ERROR: Enum = {
7+
export const ERROR: IntDict = {
88
OK: 0,
99
INTERNAL: 1,
1010
STRICT: 2,
@@ -47,13 +47,13 @@ export const ERROR: Enum = {
4747
CB_RESET: 31,
4848
};
4949

50-
export const TYPE: Enum = {
50+
export const TYPE: IntDict = {
5151
BOTH: 0, // default
5252
REQUEST: 1,
5353
RESPONSE: 2,
5454
};
5555

56-
export const FLAGS: Enum = {
56+
export const FLAGS: IntDict = {
5757
CONNECTION_KEEP_ALIVE: 1 << 0,
5858
CONNECTION_CLOSE: 1 << 1,
5959
CONNECTION_UPGRADE: 1 << 2,
@@ -66,7 +66,7 @@ export const FLAGS: Enum = {
6666
TRANSFER_ENCODING: 1 << 9,
6767
};
6868

69-
export const LENIENT_FLAGS: Enum = {
69+
export const LENIENT_FLAGS: IntDict = {
7070
HEADERS: 1 << 0,
7171
CHUNKED_LENGTH: 1 << 1,
7272
KEEP_ALIVE: 1 << 2,
@@ -79,7 +79,7 @@ export const LENIENT_FLAGS: Enum = {
7979
SPACES_AFTER_CHUNK_SIZE: 1 << 9,
8080
};
8181

82-
export const METHODS: Enum = {
82+
export const METHODS: IntDict = {
8383
'DELETE': 0,
8484
'GET': 1,
8585
'HEAD': 2,
@@ -141,7 +141,7 @@ export const METHODS: Enum = {
141141
'QUERY': 46,
142142
};
143143

144-
export const STATUSES: Enum = {
144+
export const STATUSES: IntDict = {
145145
CONTINUE: 100,
146146
SWITCHING_PROTOCOLS: 101,
147147
PROCESSING: 102,
@@ -243,13 +243,13 @@ export const STATUSES: Enum = {
243243
NETWORK_CONNECT_TIMEOUT: 599, // Unofficial
244244
};
245245

246-
export const FINISH: Enum = {
246+
export const FINISH: IntDict = {
247247
SAFE: 0,
248248
SAFE_WITH_CB: 1,
249249
UNSAFE: 2,
250250
};
251251

252-
export const HEADER_STATE: Enum = {
252+
export const HEADER_STATE: IntDict = {
253253
GENERAL: 0,
254254
CONNECTION: 1,
255255
CONTENT_LENGTH: 2,

src/llhttp/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Enum } from './constants';
1+
import { IntDict } from './constants';
22

33
export function enumToMap(
4-
obj: Enum,
4+
obj: IntDict,
55
filter: ReadonlyArray<number> = [],
66
exceptions: ReadonlyArray<number> = [],
7-
): Enum {
7+
): IntDict {
88
const emptyFilter = (filter?.length ?? 0) === 0;
99
const emptyExceptions = (exceptions?.length ?? 0) === 0;
1010

0 commit comments

Comments
 (0)