UNPKG

each-arg

Version:

Iterates through arguments or any other array-like object starting from specific index.

3 lines (2 loc) 1.73 kB
var t,n;t=this,n=function(){"use strict";var t=Array.isArray,n=Object.prototype.toString,r=t||function(t){return!!t&&"[object Array]"==n.call(t)},e=function(t){var n=o.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)},o=Object.prototype.toString,i=function(t){if(!t)return!1;if(r(t))return!0;if(e(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};function u(t){return new TypeError(t)}function f(t,n,r,e,o){var u=o-3;return 0===u?function(e){return t.call(n,r[e],e)}:1===u?function(o){return t.call(n,r[o],o,e[3])}:function(o){return t.call.apply(t,[n,r[o],o].concat(function(t,n){if(!i(t)&&""!==t)throw new TypeError(t+" can't be converted to array.");if(null==n&&(n=0),"number"!=typeof n||!isFinite(n))throw new TypeError(n+" is not a valid start point.");var r=t.length;n<0&&(n+=r);for(var e=Object(t),o=new Array(r-n),u=n;u<r;u++)u in e&&(o[u-n]=e[u]);return o}(e,3)))}}return function(t,n,r){var o=arguments,c=o.length;if(c<3)throw u("expected 3 arguments, got "+c);if(!i(t)&&""!==t)throw u(t+" can't be converted to array.");if("number"!=typeof n||!isFinite(n))throw u(n+" is not a valid start point.");if(!e(r))throw u(r+" is not a function.");var a=Object(t),l=a.length;n<0&&(n+=l);for(var p=f(r,this,a,o,c),d=n;d<l;d++)if(d in a&&p(d))return}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).eachArg=n(); //# sourceMappingURL=each-arg.umd.min.js.map