Skip to content

Commit

Permalink
Style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Dec 20, 2024
1 parent 105f5db commit 136c7aa
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions packages/headers/src/lib/super-headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,24 @@ export class SuperHeaders extends Headers {
}
}

/**
* Returns an iterator of all header keys (lowercase).
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/keys)
*/
*keys(): IterableIterator<string> {
for (let [key] of this) yield key;
}

/**
* Returns an iterator of all header values.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/values)
*/
*values(): IterableIterator<string> {
for (let [, value] of this) yield value;
}

/**
* Returns an iterator of all header key/value pairs.
*
Expand All @@ -284,9 +302,7 @@ export class SuperHeaders extends Headers {
*entries(): IterableIterator<[string, string]> {
for (let [key] of this.#map) {
let str = this.get(key);
if (str) {
yield [key, str];
}
if (str) yield [key, str];
}

for (let value of this.getSetCookie()) {
Expand All @@ -298,28 +314,6 @@ export class SuperHeaders extends Headers {
return this.entries();
}

/**
* Returns an iterator of all header keys (lowercase).
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/keys)
*/
*keys(): IterableIterator<string> {
for (let [key] of this) {
yield key;
}
}

/**
* Returns an iterator of all header values.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/values)
*/
*values(): IterableIterator<string> {
for (let [, value] of this) {
yield value;
}
}

/**
* Invokes the `callback` for each header key/value pair.
*
Expand Down Expand Up @@ -728,7 +722,7 @@ export class SuperHeaders extends Headers {
}
}

// helpers
// Helpers

#getHeaderValue<T extends HeaderValue>(key: string, ctor: new (init?: any) => T): T {
let value = this.#map.get(key);
Expand Down

0 comments on commit 136c7aa

Please sign in to comment.