Skip to main content
Module

x/scaffold/src/deps/npm.ts>objectHasOwn

scaffold your next project with style and 💗
Latest
function objectHasOwn
import { objectHasOwn } from "https://deno.land/x/scaffold@0.3.0/src/deps/npm.ts";

A strongly-typed version of Object.hasOwn().

Returns a boolean indicating whether the given object has the given property as its own property.

Examples

Example 1

import {objectHasOwn} from 'ts-extras';

objectHasOwn({}, 'hello');
//=> false

objectHasOwn([1, 2, 3], 0);
//=> true

Type Parameters

ObjectType
Key extends PropertyKey

Returns

object is (ObjectType & Record<Key, unknown>)