22 captureException ,
33 debug ,
44 flushIfServerless ,
5+ isNullish ,
56 SEMANTIC_ATTRIBUTE_CACHE_HIT ,
67 SEMANTIC_ATTRIBUTE_CACHE_KEY ,
78 SEMANTIC_ATTRIBUTE_SENTRY_OP ,
@@ -209,13 +210,6 @@ function normalizeMethodName(methodName: string): string {
209210 return methodName . replace ( / [ A - Z ] / g, letter => `_${ letter . toLowerCase ( ) } ` ) ;
210211}
211212
212- /**
213- * Checks if the value is empty, used for cache hit detection.
214- */
215- function isEmptyValue ( value : unknown ) : value is null | undefined {
216- return value === null || value === undefined ;
217- }
218-
219213/**
220214 * Creates the span start options for the storage method.
221215 */
@@ -267,7 +261,7 @@ function normalizeKey(key: unknown, prefix: string): string {
267261 return `${ prefix } ${ key . key } ` ;
268262 }
269263
270- return `${ prefix } ${ isEmptyValue ( key ) ? '' : String ( key ) } ` ;
264+ return `${ prefix } ${ isNullish ( key ) ? '' : String ( key ) } ` ;
271265}
272266
273267const CACHED_FN_HANDLERS_RE = / ^ n i t r o : ( f u n c t i o n s | h a n d l e r s ) : / i;
@@ -280,7 +274,7 @@ const CACHED_FN_HANDLERS_RE = /^nitro:(functions|handlers):/i;
280274 */
281275function isCacheHit ( key : unknown , value : unknown ) : boolean {
282276 try {
283- const isEmpty = isEmptyValue ( value ) ;
277+ const isEmpty = isNullish ( value ) ;
284278 // Empty value means no cache hit either way
285279 // Or if key doesn't match the cached function or handler patterns, we can return the empty value check
286280 if ( isEmpty || typeof key !== 'string' || ! CACHED_FN_HANDLERS_RE . test ( key ) ) {
@@ -301,7 +295,7 @@ function validateCacheEntry(
301295 key : string ,
302296 entry : CacheEntry | CacheEntry < ResponseCacheEntry & { status : number } > ,
303297) : boolean {
304- if ( isEmptyValue ( entry . value ) ) {
298+ if ( isNullish ( entry . value ) ) {
305299 return false ;
306300 }
307301
0 commit comments