Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc-cloned / node_modules / protobufjs / src / es5.js
1 // Starting with ProtoBuf.js 4.X we are no longer bundling any ES5 polyfills with the library.\r
2 // It is now up to the user to provide these as needed. For reference, this is what we use:\r
3 \r
4 // ref: https://developer.mozilla.org/de/docs/JavaScript/Reference/Global_Objects/Object/create\r
5 if (!Object.create)\r
6     /** @expose */\r
7     Object.create = function (o) {\r
8         if (arguments.length > 1)\r
9             throw Error('illegal number of arguments');\r
10         function F() {}\r
11         F.prototype = o;\r
12         return new F();\r
13     };\r
14 \r
15 // ref: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray\r
16 if (!Array.isArray)\r
17     /** @expose */\r
18     Array.isArray = function(o) {\r
19         return Object.prototype.toString.call(o) === "[object Array]";\r
20     };\r
21 \r
22 // ref: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach\r
23 if (!Array.prototype.forEach)\r
24     /** @expose */\r
25     Array.prototype.forEach = function(callback, thisArg) {\r
26         var T, k;\r
27         if (this == null)\r
28             throw new TypeError('this is null or not defined');\r
29         var O = Object(this);\r
30         var len = O.length >>> 0;\r
31         if (typeof callback !== "function")\r
32             throw new TypeError(callback + ' is not a function');\r
33         if (arguments.length > 1)\r
34             T = thisArg;\r
35         k = 0;\r
36         while (k < len) {\r
37             var kValue;\r
38             if (k in O)\r
39                 kValue = O[k],\r
40                 callback.call(T, kValue, k, O);\r
41             k++;\r
42         }\r
43     };\r