has-own-property
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i has-own-property

    Weekly Downloads

    294,446

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    2.1 kB

    Total Files

    6

    Last publish

    Collaborators

    • linusu
    • flet