mirror of
https://github.com/denoland/deno.git
synced 2025-01-18 11:53:59 -05:00
chore(extensions/console): avoid re-checking iterable type (#11349)
This commit is contained in:
parent
72ac9c3ae0
commit
df26a3563e
1 changed files with 16 additions and 9 deletions
|
@ -351,15 +351,22 @@
|
||||||
const entries = [];
|
const entries = [];
|
||||||
let iter;
|
let iter;
|
||||||
|
|
||||||
// TODO(littledivy): Avoid re-checking iterable type
|
switch (options.typeName) {
|
||||||
if (ArrayIsArray(value) || isTypedArray(value)) {
|
case "Map":
|
||||||
iter = ArrayPrototypeEntries(value);
|
|
||||||
} else if (value instanceof Set) {
|
|
||||||
iter = SetPrototypeEntries(value);
|
|
||||||
} else if (value instanceof Map) {
|
|
||||||
iter = MapPrototypeEntries(value);
|
iter = MapPrototypeEntries(value);
|
||||||
|
break;
|
||||||
|
case "Set":
|
||||||
|
iter = SetPrototypeEntries(value);
|
||||||
|
break;
|
||||||
|
case "Array":
|
||||||
|
iter = ArrayPrototypeEntries(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (isTypedArray(value)) {
|
||||||
|
iter = ArrayPrototypeEntries(value);
|
||||||
} else {
|
} else {
|
||||||
throw new TypeError("Unreachable");
|
throw new TypeError("unreachable");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let entriesLength = 0;
|
let entriesLength = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue