-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): update dependency typescript to v5.6.3 (#1644)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Arda TANRIKULU <[email protected]>
- Loading branch information
1 parent
7513cd7
commit 637185f
Showing
20 changed files
with
244 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@whatwg-node/server': patch | ||
--- | ||
|
||
Respect given fetchAPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@whatwg-node/node-fetch': minor | ||
--- | ||
|
||
Support `IteratorObject<T>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,6 @@ | |
"bun-types": "1.1.34" | ||
}, | ||
"devDependencies": { | ||
"typescript": "5.5.4" | ||
"typescript": "5.6.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import { inspect } from 'node:util'; | ||
import { isIterable } from './utils.js'; | ||
|
||
export class PonyfillIteratorObject<T> implements IteratorObject<T, undefined, unknown> { | ||
[Symbol.toStringTag] = 'IteratorObject'; | ||
constructor( | ||
private iterableIterator: IterableIterator<T>, | ||
className: string, | ||
) { | ||
this[Symbol.toStringTag] = className; | ||
} | ||
|
||
*map<U>(callbackfn: (value: T, index: number) => U) { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
yield callbackfn(value, index++); | ||
} | ||
return undefined; | ||
} | ||
|
||
*filter(callbackfn: (value: T, index: number) => boolean) { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
if (callbackfn(value, index++)) { | ||
yield value; | ||
} | ||
} | ||
return undefined; | ||
} | ||
|
||
reduce<U>( | ||
callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, | ||
initialValue?: U, | ||
) { | ||
let index = 0; | ||
let accumulator = initialValue as U; | ||
for (const value of this.iterableIterator) { | ||
accumulator = callbackfn(accumulator, value, index++); | ||
} | ||
return accumulator; | ||
} | ||
|
||
forEach(callbackfn: (value: T, index: number) => void): void { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
callbackfn(value, index++); | ||
} | ||
} | ||
|
||
*take(limit: number) { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
if (index >= limit) { | ||
break; | ||
} | ||
yield value; | ||
index++; | ||
} | ||
return undefined; | ||
} | ||
|
||
*drop(count: number): IteratorObject<T, undefined, unknown> { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
if (index >= count) { | ||
yield value; | ||
} | ||
index++; | ||
} | ||
return undefined; | ||
} | ||
|
||
*flatMap<U>( | ||
callback: ( | ||
value: T, | ||
index: number, | ||
) => Iterator<U, unknown, undefined> | Iterable<U, unknown, undefined>, | ||
): IteratorObject<U, undefined, unknown> { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
const iteratorOrIterable = callback(value, index++); | ||
if (isIterable(iteratorOrIterable)) { | ||
for (const innerValue of iteratorOrIterable) { | ||
yield innerValue; | ||
} | ||
} else { | ||
for (const innerValue of { | ||
[Symbol.iterator]: () => iteratorOrIterable, | ||
}) { | ||
yield innerValue; | ||
} | ||
} | ||
} | ||
return undefined; | ||
} | ||
|
||
some(predicate: (value: T, index: number) => unknown): boolean { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
if (predicate(value, index++)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
every(predicate: (value: T, index: number) => unknown): boolean { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
if (!predicate(value, index++)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
find(predicate: (value: T, index: number) => unknown): T | undefined { | ||
let index = 0; | ||
for (const value of this.iterableIterator) { | ||
if (predicate(value, index++)) { | ||
return value; | ||
} | ||
} | ||
return undefined; | ||
} | ||
|
||
toArray(): T[] { | ||
return Array.from(this.iterableIterator); | ||
} | ||
|
||
[Symbol.dispose](): void { | ||
if (typeof (this.iterableIterator as any).return === 'function') { | ||
(this.iterableIterator as any).return(); | ||
} | ||
} | ||
|
||
next(...[value]: [] | [unknown]): IteratorResult<T, undefined> { | ||
return this.iterableIterator.next(value); | ||
} | ||
|
||
[Symbol.iterator](): URLSearchParamsIterator<T> { | ||
return this; | ||
} | ||
|
||
[Symbol.for('nodejs.util.inspect.custom')]() { | ||
const record: Record<string, string[] | string> = {}; | ||
this.forEach((value, key) => { | ||
const inspectedValue = inspect(value); | ||
record[key] = inspectedValue.includes(',') | ||
? inspectedValue.split(',').map(el => el.trim()) | ||
: inspectedValue; | ||
}); | ||
return `${this[Symbol.toStringTag]} ${inspect(record)}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.