https://github.com/xotic750/reflect-define-property-x
Sham for Reflect.defineProperty
https://github.com/xotic750/reflect-define-property-x
browser defineproperty javascript nodejs reflect
Last synced: 3 months ago
JSON representation
Sham for Reflect.defineProperty
- Host: GitHub
- URL: https://github.com/xotic750/reflect-define-property-x
- Owner: Xotic750
- License: mit
- Created: 2017-04-16T11:14:45.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T22:40:25.000Z (over 2 years ago)
- Last Synced: 2025-01-18T08:45:21.497Z (4 months ago)
- Topics: browser, defineproperty, javascript, nodejs, reflect
- Language: JavaScript
- Size: 2.39 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 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**
```js
import reflectDefineProperty from 'reflect-define-property-x';const obj = {};
reflectDefineProperty(obj, 'x', {value: 7}); // true
console.log(obj.x); // 7
```