]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Revert "Move require rename inside try/catch"
authorIskren Chernev <iskren.chernev@gmail.com>
Tue, 10 Oct 2017 08:22:33 +0000 (11:22 +0300)
committerIskren Chernev <iskren.chernev@gmail.com>
Tue, 10 Oct 2017 22:24:12 +0000 (01:24 +0300)
This reverts commit 79e9131fdab17d0afe4211b068a353b2bb5749b5.

src/lib/locale/locales.js

index 2f5f2d8b0c7fa64f412b86f245ce17175bacadb1..d8bb937c95516a773ec8e7a119a0041aba801cc3 100644 (file)
@@ -46,23 +46,22 @@ function chooseLocale(names) {
 }
 
 function loadLocale(name) {
-    var oldLocale = null;
+    var oldLocale = null,
+        // workaround for React Native 0.49+
+        pretendingNotToRequire = require;
 
     // TODO: Find a better way to register and load all the locales in Node
     if (!locales[name] && (typeof module !== 'undefined') &&
             module && module.exports) {
         oldLocale = globalLocale._abbr;
         try {
-            // workaround for React Native 0.49+
-            var pretendingNotToRequireV1 = require;
-            pretendingNotToRequireV1('moment/locale/' + name);
+            pretendingNotToRequire('moment/locale/' + name);
         } catch (e) {
             // In the test environment, the external module 'moment'
             // can't be resolved because we're running inside it.
             // Fallback to using the old relative import
             try {
-                var pretendingNotToRequireV2 = require;
-                pretendingNotToRequireV2('./locale/' + name);
+                pretendingNotToRequire('./locale/' + name);
             } catch (e) { }
         }