Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarabyte/redefine-properties
Define properties using multiple source objects
https://github.com/tarabyte/redefine-properties
Last synced: about 2 months ago
JSON representation
Define properties using multiple source objects
- Host: GitHub
- URL: https://github.com/tarabyte/redefine-properties
- Owner: Tarabyte
- License: mit
- Created: 2015-09-27T17:12:02.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-27T20:58:43.000Z (over 9 years ago)
- Last Synced: 2024-11-03T00:33:25.546Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 141 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Redefine Properties
Merge multiple objects' properties into target by redefining properties using extracted property descriptors.- Works with multiple sources.
- Copies all own properties including nonenumerable ones.
- Uses `Object.defineProperty` for all properties.
- In case of conflict the last source of a property wins.*NB: Mutates the first argument!*
## Example
```javascript
var redefine = require('redefine-properties');var source = {
get a() {
return 42;
}
};
var target = {};redefine(target, source);
target.a === 42;
```