mdn-polyfills
Version:
MDN polyfills
2 lines (1 loc) • 788 B
JavaScript
!function(){var t,u,e,c;Array.from||(Array.from=(t=Object.prototype.toString,u=function(r){return"function"==typeof r||"[object Function]"===t.call(r)},e=Math.pow(2,53)-1,c=function(r){var t,n=(t=Number(r),isNaN(t)?0:0!==t&&isFinite(t)?(0<t?1:-1)*Math.floor(Math.abs(t)):t);return Math.min(Math.max(n,0),e)},function(r){var t=Object(r);if(null==r)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n,e=1<arguments.length?arguments[1]:void 0;if(void 0!==e){if(!u(e))throw new TypeError("Array.from: when provided, the second argument must be a function");2<arguments.length&&(n=arguments[2])}for(var o,a=c(t.length),i=u(this)?Object(new this(a)):new Array(a),f=0;f<a;)o=t[f],i[f]=e?void 0===n?e(o,f):e.call(n,o,f):o,f+=1;return i.length=a,i}))}();