Socket
Book a DemoInstallSign in
Socket

property-exists

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

property-exists

Return a boolean indicating whether the object has the specified property (as a direct property of that object)

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

property-exists

Return a boolean indicating whether the object has the specified property (as a direct property of that object)

Install

$ npm install --save property-exists

Usage

var propertyExists = require('property-exists');

var person = {
  name: 'Ygritte',
  say: function() {
    return "You know nothing, Jon Snow";
  }
};

propertyExists(person, 'name'); // => true
propertyExists(person, 'foobar'); // => false

var anotherPerson = Object.create(person);

propertyExists(anotherPerson, 'name'); // => false

API

propertyExists()

Return a boolean indicating whether the object has the specified property (as a direct property of that object)

Params

  • Object obj - An object to test
  • String key - A property name to test

Return

  • Boolean - Result

License

MIT © Philipp Alferov

Keywords

property

FAQs

Package last updated on 10 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts