Skip to content

Commit cf3a0dd

Browse files
committed
Inline parameters type
1 parent 1ec3b1f commit cf3a0dd

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ An ES (JavaScript & TypeScript) module to handle the [HTTP header `Link`](https:
6363
getByRel(value: string): HTTPHeaderLinkEntry[];
6464
hasParameter(key: string, value: string): boolean;
6565
toString(): string;
66-
static parse(input: string | Headers | HTTPHeaderLink | Response): HTTPHeaderLink;
67-
static stringify(input: HTTPHeaderLinkEntry[]): string;
66+
static parse(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): HTTPHeaderLink;
67+
static stringify(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): string;
6868
}
6969
```
7070
- ```ts

mod.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class HTTPHeaderLink {
137137
#entries: HTTPHeaderLinkEntry[] = [];
138138
/**
139139
* Handle the HTTP header `Link` according to the specification RFC 8288.
140-
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Inputs.
140+
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Input.
141141
*/
142142
constructor(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]) {
143143
if (inputs.length > 0) {
@@ -146,7 +146,7 @@ export class HTTPHeaderLink {
146146
}
147147
/**
148148
* Add entries.
149-
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Inputs.
149+
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Input.
150150
* @returns {this}
151151
*/
152152
add(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): this {
@@ -191,7 +191,7 @@ export class HTTPHeaderLink {
191191
* Get entries by parameter.
192192
* @param {string} key Key of the parameter.
193193
* @param {string} value Value of the parameter.
194-
* @returns {HTTPHeaderLinkEntry[]} Entries.
194+
* @returns {HTTPHeaderLinkEntry[]} Entries which match the parameter.
195195
*/
196196
getByParameter(key: string, value: string): HTTPHeaderLinkEntry[] {
197197
if (key !== key.toLowerCase()) {
@@ -207,7 +207,7 @@ export class HTTPHeaderLink {
207207
/**
208208
* Get entries by parameter `rel`.
209209
* @param {string} value Value of the parameter `rel`.
210-
* @returns {HTTPHeaderLinkEntry[]} Entries.
210+
* @returns {HTTPHeaderLinkEntry[]} Entries which match the parameter.
211211
*/
212212
getByRel(value: string): HTTPHeaderLinkEntry[] {
213213
if (value !== value.toLowerCase()) {
@@ -221,7 +221,7 @@ export class HTTPHeaderLink {
221221
* Whether have entries that match parameter.
222222
* @param {string} key Key of the parameter.
223223
* @param {string} value Value of the parameter.
224-
* @returns {boolean} Result.
224+
* @returns {boolean} Determine result.
225225
*/
226226
hasParameter(key: string, value: string): boolean {
227227
return (this.getByParameter(key, value).length > 0);
@@ -242,19 +242,19 @@ export class HTTPHeaderLink {
242242
}
243243
/**
244244
* Parse the HTTP header `Link` according to the specification RFC 8288.
245-
* @param {string | Headers | HTTPHeaderLink | Response} input Input.
245+
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Input.
246246
* @returns {HTTPHeaderLink}
247247
*/
248-
static parse(input: string | Headers | HTTPHeaderLink | Response): HTTPHeaderLink {
249-
return new this(input);
248+
static parse(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): HTTPHeaderLink {
249+
return new this(...inputs);
250250
}
251251
/**
252252
* Stringify as the HTTP header `Link` according to the specification RFC 8288.
253-
* @param {HTTPHeaderLinkEntry[]} input Input.
253+
* @param {...(string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)} inputs Input.
254254
* @returns {string}
255255
*/
256-
static stringify(input: HTTPHeaderLinkEntry[]): string {
257-
return new this(input).toString();
256+
static stringify(...inputs: (string | Headers | HTTPHeaderLink | HTTPHeaderLinkEntry[] | Response)[]): string {
257+
return new this(...inputs).toString();
258258
}
259259
}
260260
export default HTTPHeaderLink;

0 commit comments

Comments
 (0)