
Product
Introducing Socket Scanning for OpenVSX Extensions
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
es-abstract-has-property
Advanced tools
A method to determine whether an object has a property with the specified property key. The property may be either an own or inherited. This method follows ECMAScript's specification for the 'HasProperty' abstract operation.
A method to determine whether an object has a property with the specified property key. The property may be either an own or inherited. This method follows ECMAScript's specification for the 'HasProperty' abstract operation.
Currently, this module only supports the ES2017 (ES8) specification.
While working on a module, I found myself with a need to reproduce ECMAScript internal methods and abstract operations. I wanted smaller, modular code instead of a larger library.
npm install es-abstract-has-property
var hasProperty = require('es-abstract-has-property');
function Animal(obj){
this.animalInstanceMethod_A = function alfa(a) {}
this.init.apply(this, arguments)
}
Animal.prototype.init = function animalInit() {
this.animalInstanceMethod_B = function bravo(b) {}
}
Animal.animalStaticMethod = function charlie(c) {}
Animal.prototype.animalPrototypeMethod = function delta(d) {}
function Cat(){
this.init.apply(this, arguments)
}
Cat.prototype = Object.create(Animal.prototype)
Cat.prototype.constructor = Cat
Cat.prototype.init = function catInit() {
Animal.prototype.init.call(this)
this.catInstanceMethod = function echo(e) {}
}
var c = new Cat()
console.log(c.hasOwnProperty("animalPrototypeMethod")) // => false
console.log(hasProperty(c, "animalPrototypeMethod")) // => true
console.log(hasProperty(c, "animalInstanceMethod_A")) // => false
console.log(hasProperty(c, "animalInstanceMethod_B")) // => true
console.log(hasProperty(c, "animalStaticMethod")) // => false
Determine whether an object has a property with the specified property key. The property may be either an own or inherited.
A Boolean value is returned.
Type: Object
The object being checked. Values will be coerced using Object(O), allowing for the checking of properties such as "length" on a string primitive.
Type: String
The property key to look for on the object.
FAQs
A method to determine whether an object has a property with the specified property key. The property may be either an own or inherited. This method follows ECMAScript's specification for the 'HasProperty' abstract operation.
We found that es-abstract-has-property demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies