Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
370 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | export default function _defaults(obj, defaults) {
|
---|
| 2 | var keys = Object.getOwnPropertyNames(defaults);
|
---|
| 3 |
|
---|
| 4 | for (var i = 0; i < keys.length; i++) {
|
---|
| 5 | var key = keys[i];
|
---|
| 6 | var value = Object.getOwnPropertyDescriptor(defaults, key);
|
---|
| 7 |
|
---|
| 8 | if (value && value.configurable && obj[key] === undefined) {
|
---|
| 9 | Object.defineProperty(obj, key, value);
|
---|
| 10 | }
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | return obj;
|
---|
| 14 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.