Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc / node_modules / protobufjs / src / es5.js
diff --git a/legacy-libs/grpc/node_modules/protobufjs/src/es5.js b/legacy-libs/grpc/node_modules/protobufjs/src/es5.js
new file mode 100644 (file)
index 0000000..83b4c71
--- /dev/null
@@ -0,0 +1,43 @@
+// Starting with ProtoBuf.js 4.X we are no longer bundling any ES5 polyfills with the library.\r
+// It is now up to the user to provide these as needed. For reference, this is what we use:\r
+\r
+// ref: https://developer.mozilla.org/de/docs/JavaScript/Reference/Global_Objects/Object/create\r
+if (!Object.create)\r
+    /** @expose */\r
+    Object.create = function (o) {\r
+        if (arguments.length > 1)\r
+            throw Error('illegal number of arguments');\r
+        function F() {}\r
+        F.prototype = o;\r
+        return new F();\r
+    };\r
+\r
+// ref: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray\r
+if (!Array.isArray)\r
+    /** @expose */\r
+    Array.isArray = function(o) {\r
+        return Object.prototype.toString.call(o) === "[object Array]";\r
+    };\r
+\r
+// ref: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach\r
+if (!Array.prototype.forEach)\r
+    /** @expose */\r
+    Array.prototype.forEach = function(callback, thisArg) {\r
+        var T, k;\r
+        if (this == null)\r
+            throw new TypeError('this is null or not defined');\r
+        var O = Object(this);\r
+        var len = O.length >>> 0;\r
+        if (typeof callback !== "function")\r
+            throw new TypeError(callback + ' is not a function');\r
+        if (arguments.length > 1)\r
+            T = thisArg;\r
+        k = 0;\r
+        while (k < len) {\r
+            var kValue;\r
+            if (k in O)\r
+                kValue = O[k],\r
+                callback.call(T, kValue, k, O);\r
+            k++;\r
+        }\r
+    };\r