Sha256: 6a2849c26b589369c61e991f09dfde0c81508b702f77297fe58c20a5788f14fa
Contents?: true
Size: 500 Bytes
Versions: 26
Compression:
Stored size: 500 Bytes
Contents
/** * A function that validates if property access is possible on an object * without throwing. It returns `true` if the property access is possible * and `false` otherwise. * * Environments like miniflare will throw on property access on certain objects * like Request and Response, for unimplemented properties. */ export function isPropertyAccessible<Obj extends Record<string, any>>( obj: Obj, key: keyof Obj ) { try { obj[key] return true } catch { return false } }
Version data entries
26 entries across 26 versions & 1 rubygems