Skip to content

Commit

Permalink
perf: move common check earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 12, 2023
1 parent 448a77d commit 5be5732
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export default function destr<T = unknown>(
if (_lval === "false") {
return false as T;
}
if (_lval === "undefined") {
return undefined as T;
}
if (_lval === "null") {
// eslint-disable-next-line unicorn/no-null
return null as T;
Expand All @@ -57,9 +60,6 @@ export default function destr<T = unknown>(
if (_lval === "-infinity") {
return Number.NEGATIVE_INFINITY as T;
}
if (_lval === "undefined") {
return undefined as T;
}

if (!JsonSigRx.test(value)) {
if (options.strict) {
Expand Down

0 comments on commit 5be5732

Please sign in to comment.