@web3r/flowerkit
Version:
Tree-shakable JavaScript and TypeScript utility library for frontend/browser apps: DOM, events, arrays, objects, strings, date, JSON, and network helpers (ESM/CJS, SSR-friendly).
18 lines (17 loc) • 826 B
text/typescript
export type TIsObjHasOwnPropArgs = Parameters<typeof isObjHasOwnProp>;
export type TIsObjHasOwnPropReturn = ReturnType<typeof isObjHasOwnProp>;
/**
* Checks if an object has own property
* @param {object} obj Source object
* @param {PropertyKey} prop Property name
* @see https://eslint.org/docs/latest/rules/no-prototype-builtins
* @returns {boolean} True if own property exists
* @throws {TypeError} isObjHasOwnProp: obj must be an object
* @throws {TypeError} isObjHasOwnProp: prop must be a string|number|symbol
* @example
* // How to check if an object has property without calling method directly?
* const obj = { foo: "bar" };
* const isHasOwnProp = isObjHasOwnProp(obj, "foo");
* console.log(isHasOwnProp); // => true
*/
export declare const isObjHasOwnProp: (obj: unknown, prop: PropertyKey) => boolean;