Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
462 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 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 | }
|
---|
| 15 |
|
---|
| 16 | module.exports = _defaults;
|
---|
| 17 | module.exports["default"] = module.exports, module.exports.__esModule = true; |
---|
Note:
See
TracBrowser
for help on using the repository browser.