Skip to content

Commit

Permalink
refactor: cleanup isFunction() helper implementation
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 c13fc14 commit 8c679f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ export async function run(opts = {}) {
throw new TypeError(
`expected function as 'now' option, got ${opts.now.constructor.name}`
)

opts.silent = opts.silent ?? false
opts.units = opts.units ?? false
opts.colors = opts.colors ?? colors
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const isFunction = fn => {
return [Function, AsyncFunction].includes(fn.constructor)
return typeof fn === 'function'
}

export const AsyncFunction = (async () => {}).constructor
Expand Down

0 comments on commit 8c679f4

Please sign in to comment.