Skip to content

Commit 5be5732

Browse files
committedJun 12, 2023
perf: move common check earlier
1 parent 448a77d commit 5be5732

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export default function destr<T = unknown>(
4444
if (_lval === "false") {
4545
return false as T;
4646
}
47+
if (_lval === "undefined") {
48+
return undefined as T;
49+
}
4750
if (_lval === "null") {
4851
// eslint-disable-next-line unicorn/no-null
4952
return null as T;
@@ -57,9 +60,6 @@ export default function destr<T = unknown>(
5760
if (_lval === "-infinity") {
5861
return Number.NEGATIVE_INFINITY as T;
5962
}
60-
if (_lval === "undefined") {
61-
return undefined as T;
62-
}
6363

6464
if (!JsonSigRx.test(value)) {
6565
if (options.strict) {

0 commit comments

Comments
 (0)
Please sign in to comment.