object-get-own-property-descriptor-x

Sham for ES6 Object.getOwnPropertyDescriptor

MIT 29 个版本
安装
npm install object-get-own-property-descriptor-x
yarn add object-get-own-property-descriptor-x
pnpm add object-get-own-property-descriptor-x
bun add object-get-own-property-descriptor-x
README

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
// }
版本列表
4.1.2 2019-08-28
4.1.1 2019-08-20
4.1.0 2019-08-14
4.0.19 2019-08-05
4.0.18 2019-07-31
4.0.17 2019-07-27
4.0.16 2019-07-27
4.0.15 2019-07-26
4.0.14 2019-07-25
4.0.13 2019-07-24
4.0.12 2019-07-24
4.0.11 2019-07-22
4.0.10 2019-07-21
4.0.9 2019-07-19
4.0.8 2019-07-18
4.0.7 2019-07-18
4.0.6 2019-07-17
4.0.5 2019-07-17
4.0.4 2019-07-16
4.0.3 2019-07-16
4.0.2 2019-07-16
4.0.1 2019-07-15
4.0.0 2019-07-15
3.2.0 2017-09-14
3.1.0 2017-09-04
3.0.0 2017-09-01
2.0.0 2017-08-30
1.1.0 2017-07-13
1.0.0 2017-04-16