@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 1.51 kB
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import e from"./../utils/define-nonenumerable-read-only-property.js";import r from"./../assert/is-function.js";import n from"./../assert/is-array-like-object.js";import t from"./../assert/is-nonnegative-integer.js";import i from"./../assert/is-integer.js";import a from"./../symbol/iterator.js";var o=e,u=r,m=n,s=t.isPrimitive,l=i.isPrimitive,f=a;function g(e,r,n,t){var i,a,v,d,p,c;if(!s(e))throw new TypeError("invalid argument. First argument must be a nonnegative integer. Value: `"+e+"`.");if(!m(r))throw new TypeError("invalid argument. Second argument must be an array-like object. Value: `"+r+"`.");if(!l(n))throw new TypeError("invalid argument. Third argument must be an integer. Value: `"+n+"`.");if(!s(t))throw new TypeError("invalid argument. Fourth argument must be a nonnegative integer. Value: `"+t+"`.");if(arguments.length>4){if(!u(d=arguments[4]))throw new TypeError("invalid argument. Fifth argument must be a function. Value: `"+d+"`.");i=arguments[5]}return p=t,c=-1,o(a={},"next",d?h:w),o(a,"return",y),f&&o(a,f,b),a;function h(){var t;return c+=1,v||c>=e?{done:!0}:(t=d.call(i,r[p],p,c,r),p+=n,{value:t,done:!1})}function w(){var t;return c+=1,v||c>=e?{done:!0}:(t=r[p],p+=n,{value:t,done:!1})}function y(e){return v=!0,arguments.length?{value:e,done:!0}:{done:!0}}function b(){return d?g(e,r,n,t,d,i):g(e,r,n,t)}}var v=g;export default v;
//# sourceMappingURL=to-strided-iterator.js.map