]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Changed to the simpler workaround rather than full blown fix.
authorXotic750 <xotic750@gmail.com>
Tue, 17 Sep 2013 23:19:16 +0000 (01:19 +0200)
committerXotic750 <xotic750@gmail.com>
Tue, 17 Sep 2013 23:19:16 +0000 (01:19 +0200)
https://github.com/moment/moment/issues/1114#issuecomment-24629678

moment.js

index 1e76284df97ce08673facb98d942a0c04bf3fe19..ddf3240542ffbb43f6cd0cf3a46eb846944233db 100644 (file)
--- a/moment.js
+++ b/moment.js
     var moment,
         VERSION = "2.2.1",
         round = Math.round,
-
-        // variable for extend closure function
-        extend,
-
         i,
 
         // internal storage for language config files
     ************************************/
 
 
-    extend = (function () {
-        var hasDontEnumBug = true,
-            dontEnums = [
-                "toString",
-                "toLocaleString",
-                "valueOf",
-                "hasOwnProperty",
-                "isPrototypeOf",
-                "propertyIsEnumerable",
-                "constructor"
-            ],
-            dontEnumsLength = dontEnums.length,
-            testObject = {
-                "toString": null
-            },
-            key;
-
-        for (key in testObject) {
-            hasDontEnumBug = false;
+function extend(a, b) {
+    for (var i in b) {
+        if (b.hasOwnProperty(i)) {
+            a[i] = b[i];
         }
+    }
 
-        return function extend(a, b) {
-            var name,
-                index,
-                dontEnum;
-
-            for (name in b) {
-                if (b.hasOwnProperty(name)) {
-                    a[name] = b[name];
-                }
-            }
+    if (b.hasOwnProperty("toString")) {
+        a.toString = b.toString;
+    }
 
-            if (hasDontEnumBug) {
-                for (index = 0; index < dontEnumsLength; index += 1) {
-                    dontEnum = dontEnums[index];
-                    if (b.hasOwnProprty(dontEnum)) {
-                        a[dontEnum] = b[dontEnum];
-                    }
-                }
-            }
+    if (b.hasOwnProperty("valueOf")) {
+        a.valueOf = b.valueOf;
+    }
 
-            return a;
-        };
-    }());
+    return a;
+}
 
     function absRound(number) {
         if (number < 0) {