polyfill-service
Version:
A polyfill combinator
1 lines • 1.96 kB
JSON
{"aliases":["default","es5","modernizr:es5array"],"browsers":{"ie":"6 - 8"},"spec":"http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.reduceright","docs":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight","baseDir":"Array/prototype/reduceRight","hasTests":true,"rawSource":"\n// Array.prototype.reduceRight\nArray.prototype.reduceRight = function reduceRight(callback) {\n\tif (this === undefined || this === null) {\n\t\tthrow new TypeError(this + 'is not an object');\n\t}\n\n\tif (!(callback instanceof Function)) {\n\t\tthrow new TypeError(callback + ' is not a function');\n\t}\n\n\tvar\n\tobject = Object(this),\n\tscope = arguments[1],\n\tarraylike = object instanceof String ? object.split('') : object,\n\tlength = -1,\n\tindex = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0,\n\tpreviousValue;\n\n\tif (1 in arguments) {\n\t\tpreviousValue = arguments[1];\n\t} else {\n\t\twhile (--index > length && !(index in arraylike)) {}\n\n\t\tif (index <= length) {\n\t\t\tthrow new TypeError('Reduce of empty array with no initial value');\n\t\t}\n\n\t\tpreviousValue = arraylike[index];\n\t}\n\n\twhile (--index > length) {\n\t\tif (index in arraylike) {\n\t\t\tpreviousValue = callback(previousValue, arraylike[index], index, object);\n\t\t}\n\t}\n\n\treturn previousValue;\n};\n","minSource":"Array.prototype.reduceRight=function(t){if(void 0===this||null===this)throw new TypeError(this+\"is not an object\");if(!(t instanceof Function))throw new TypeError(t+\" is not a function\");var i,n=Object(this),r=(arguments[1],n instanceof String?n.split(\"\"):n),e=-1,o=Math.max(Math.min(r.length,9007199254740991),0)||0;if(1 in arguments)i=arguments[1];else{for(;--o>e&&!(o in r););if(e>=o)throw new TypeError(\"Reduce of empty array with no initial value\");i=r[o]}for(;--o>e;)o in r&&(i=t(i,r[o],o,n));return i};","detectSource":"'reduceRight' in Array.prototype"}