Skip to content

Commit

Permalink
refactor: use isFunction() in more code paths
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
jerome-benoit committed Oct 3, 2024
1 parent e16cbe1 commit 57e0b32
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ export const spawnSync = (() => {
export const gc = (() => {
return {
unknown: () =>
typeof globalThis.gc === 'function'
? () => globalThis.gc()
: emptyFunction,
isFunction(globalThis.gc) ? () => globalThis.gc() : emptyFunction,
browser: () => {
try {
globalThis.$262.gc()
Expand All @@ -137,9 +135,7 @@ export const gc = (() => {
gc()
},
deno: () =>
typeof globalThis.gc === 'function'
? () => globalThis.gc()
: emptyFunction,
isFunction(globalThis.gc) ? () => globalThis.gc() : emptyFunction,
bun: () => () => Bun.gc(true),
}[runtime]()
})()
Expand Down

0 comments on commit 57e0b32

Please sign in to comment.