args-to-arr
Version:
converts arguments or any other array-like object into an array starting from specific index.
3 lines (2 loc) • 1.16 kB
JavaScript
var t,n;t=this,n=function(){var t=Array.isArray,n=Object.prototype.toString,e=t||function(t){return!!t&&"[object Array]"==n.call(t)},r=Object.prototype.toString,o=function(t){if(!t)return!1;if(e(t))return!0;if(function(t){if(!t)return!1;var n=r.call(t);return"[object Function]"===n||"function"==typeof t&&"[object RegExp]"!==n||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}(t)||function(t){if(null==t)return!1;var n=Object(t);return n===n.window}(t))return!1;var n="length"in(t=Object(t))&&t.length;return!(1!==t.nodeType||!n)||0===n||"number"==typeof n&&n>0&&n-1 in t};return function(t,n){if(!o(t)&&""!==t)throw new TypeError("".concat(t," can't be converted to array."));if(null==n&&(n=0),"number"!=typeof n||!Number.isFinite(n))throw new TypeError("".concat(n," is not a valid start point."));var e=t.length;n<0&&(n+=e);for(var r=Object(t),i=new Array(e-n),f=n;f<e;f++)f in r&&(i[f-n]=r[f]);return i}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).toArray=n();
//# sourceMappingURL=args-to-arr.umd.min.js.map