mirror of
https://github.com/status-im/metro.git
synced 2025-03-01 11:10:36 +00:00
Support for defineEnumerableProperties
Summary: **Motivation** detailed in #12702. **Test plan** 1) running [a piece of code](https://github.com/mobxjs/mobx/issues/839#issuecomment-284153126) that utilizes the helper without any modifications on the react native package results an error being thrown.  2) updating the list of helpers available by adding the definition of `defineEnumerableProperties` as provided by babel [babel/babel/packages/babel-helpers/src/helpers.js](https://github.com/babel/babel/blob/master/packages/babel-helpers/src/helpers.js#L275-L285) results no errors.  Closes https://github.com/facebook/react-native/pull/12703 Differential Revision: D4658120 Pulled By: ericvicenti fbshipit-source-id: 914aed4d313b3cc4f7ab99049d05d0aef269a3be
This commit is contained in:
parent
a826db50a8
commit
2c79f214ea
@ -63,6 +63,16 @@ babelHelpers.createClass = (function () {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
babelHelpers.defineEnumerableProperties = function(obj, descs) {
|
||||||
|
for (var key in descs) {
|
||||||
|
var desc = descs[key];
|
||||||
|
desc.configurable = (desc.enumerable = true);
|
||||||
|
if ('value' in desc) desc.writable = true;
|
||||||
|
Object.defineProperty(obj, key, desc);
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
babelHelpers.defineProperty = function (obj, key, value) {
|
babelHelpers.defineProperty = function (obj, key, value) {
|
||||||
if (key in obj) {
|
if (key in obj) {
|
||||||
Object.defineProperty(obj, key, {
|
Object.defineProperty(obj, key, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user