reflect-define-property-x

3.1.2 • Public • Published

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

reflect-define-property-x

Sham for Reflect.defineProperty

module.exports(target, propertyKey, attributes)Object

This method allows precise addition to or modification of a property on an object. For more details see the Object.defineProperty which is similar. Object.defineProperty returns the object or throws a TypeError if the property has not been successfully defined. Reflect.defineProperty, however, simply returns a Boolean indicating whether or not the property was successfully defined.

Kind: Exported function
Returns: Object - A Boolean indicating whether or not the property was successfully defined.
Throws:

  • TypeError If target is not an Object.
Param Type Description
target * The target object on which to define the property.
propertyKey * The name of the property to be defined or modified.
attributes * The attributes for the property being defined or modified.

Example

import reflectDefineProperty from 'reflect-define-property-x';
 
const obj = {};
reflectDefineProperty(obj, 'x', {value: 7}); // true
console.log(obj.x); // 7

/reflect-define-property-x/

    Package Sidebar

    Install

    npm i reflect-define-property-x

    Weekly Downloads

    8

    Version

    3.1.2

    License

    MIT

    Unpacked Size

    541 kB

    Total Files

    11

    Last publish

    Collaborators

    • xotic750