Skip to content

Commit 1db02b5

Browse files
committed
feat(cache): use utility function for Bun check
This commit replaces the direct check for globalThis.Bun in the hash function with a call to the utility function isBun(). This improves code readability and consistency.
1 parent 7124b1f commit 1db02b5

File tree

1 file changed

+2
-1
lines changed
  • packages/unplugin-typia/src/core

1 file changed

+2
-1
lines changed

packages/unplugin-typia/src/core/cache.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { basename, dirname, join } from 'pathe';
44
import type { Tagged } from 'type-fest';
55
import type { transformTypia } from './typia.js';
66
import type { ResolvedOptions } from './options.js';
7+
import { isBun } from './utils.js';
78

89
type ResolvedCacheOptions = ResolvedOptions['cache'];
910

@@ -152,7 +153,7 @@ function isWritable(filename: string): boolean {
152153
* @returns The hash string.
153154
*/
154155
function hash(input: string): string {
155-
if (globalThis.Bun != null) {
156+
if (isBun()) {
156157
return Bun.hash(input).toString();
157158
}
158159
return createHash('md5').update(input).digest('hex');

0 commit comments

Comments
 (0)