has-own-property

Check if an object has a local property.

MIT 3 个版本
安装
npm install has-own-property
yarn add has-own-property
pnpm add has-own-property
bun add has-own-property
README

Has Own Property?

Check if an object has a local property.

Installation

npm install --save has-own-property

Usage

import hasOwnProperty from 'has-own-property'

const obj = { a: 1 }

hasOwnProperty(obj, 'a') // true
hasOwnProperty(obj, 'b') // false

API

hasOwnProperty(object, name)

  • object (object, required)
  • name (string | number | symbol, required)
  • returns boolean

Determines whether an object has a property with the specified name.

版本列表
2.0.0 2021-07-24
1.0.0 2016-09-22
0.1.0 2016-06-03