UNPKG

@stdlib/esm

Version:

ES module distribution for Stdlib, a standard library for JavaScript and Node.js.

3 lines 2.01 kB
// 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-nonnegative-integer.js";import t from"./../assert/is-positive-integer.js";import n from"./../assert/is-boolean.js";import i from"./../assert/is-function.js";import o from"./../assert/is-iterator-like.js";import a from"./../assert/has-own-property.js";import u from"./../symbol/iterator.js";var s=e,l=r.isPrimitive,m=t.isPrimitive,f=n.isPrimitive,v=i,p=o,g=a,d=u,h=0,c=!1;function w(e,r,t,n,i){var o,a,u,b,y,j,T,E,V;if(!p(e))throw new TypeError("invalid argument. First argument must be an iterator protocol-compliant object. Value: `"+e+"`.");if(!v(r))throw new TypeError("invalid argument. Second argument must be a function. Value: `"+r+"`.");if(3===arguments.length)l(t)?y=t:(y=h,j=t),u=c;else if(4===arguments.length){if(!l(t))throw new TypeError("invalid argument. Third argument must be a nonnegative integer. Value: `"+t+"`.");y=t,f(n)?u=n:(u=c,j=n)}else if(arguments.length>4){if(!l(t))throw new TypeError("invalid argument. Third argument must be a nonnegative integer. Value: `"+t+"`.");if(y=t,!f(n))throw new TypeError("invalid argument. Fourth argument must be a boolean. Value: `"+n+"`.");u=n,j=i}else y=h,u=c;if(u){for(E=0;E<y;E++)if(e.next().done){b=!0;break}E-=1}else E=-1;return V=-1,o=0,s(a={},"next",x),s(a,"return",k),d&&v(e[d])&&(T=y,s(a,d,P)),a;function x(){var t,n;if(b)return{done:!0};for(E+=1;E<y;){if((n=e.next()).done)return b=!0,{done:!0};E+=1}if((n=e.next()).done)return b=!0,t={},g(n,"value")&&(t.value=n.value),t.done=!0,t;if(V+=1,o=r.call(j,n.value,E,V,o),!m(o))throw new TypeError("invalid return value. Callback function must return a positive integer. Value: `"+o+"`.");return y+=o,{value:n.value,done:!1}}function k(e){return b=!0,arguments.length?{value:e,done:!0}:{done:!0}}function P(){return w(e[d](),r,T,u,j)}}var b=w;export default b; //# sourceMappingURL=strided-by.js.map