UNPKG

@storm-stack/types

Version:

⚡ The storm-stack monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.

14 lines (13 loc) 540 B
import { isObject } from "./is-object.mjs"; export const propertyExists = (object, propertyKey) => { try { return isObject(object) && propertyKey in object; } catch { return false; } }; export const propertyUnsafe = (object, propertyKey) => { return propertyExists(object, propertyKey) && // Properties are safe to merge if they don't exist in the target yet, !(Object.hasOwnProperty.call(object, propertyKey) && // unsafe if they exist up the prototype chain, Object.propertyIsEnumerable.call(object, propertyKey)); };