object-get-own-property-descriptor-x

4.1.2 • Public • Published

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

object-get-own-property-descriptor-x

Sham for ES6 Object.getOwnPropertyDescriptor

module.exportsObject

This method returns a property descriptor for an own property (that is, one directly present on an object and not in the object's prototype chain) of a given object.

Kind: Exported member
Returns: Object - A property descriptor of the given property if it exists on the object, undefined otherwise.

Param Type Description
object * The object in which to look for the property.
property * The name of the property whose description is to be retrieved.

Example

import getOwnPropertyDescriptor from 'object-get-own-property-descriptor-x';
const obj = {bar: 42};
console.log(getOwnPropertyDescriptor(o, 'bar'));
// {
//   configurable: true,
//   enumerable: true,
//   value: 42,
//   writable: true
// }

/object-get-own-property-descriptor-x/

    Package Sidebar

    Install

    npm i object-get-own-property-descriptor-x

    Weekly Downloads

    6,448

    Version

    4.1.2

    License

    MIT

    Unpacked Size

    317 kB

    Total Files

    11

    Last publish

    Collaborators

    • xotic750