@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 1.35 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-nonnegative-integer.js";import n from"./../assert/is-function.js";import t from"./../assert/is-iterator-like.js";import o from"./../assert/has-own-property.js";import i from"./../symbol/iterator.js";var a=e,u=r.isPrimitive,s=n,l=t,m=o,f=i,v=0,p=1e308;function d(e,r,n){var t,o,i,g,c,h;if(!l(e))throw new TypeError("invalid argument. First argument must be an iterator protocol-compliant object. Value: `"+e+"`.");if(arguments.length>1){if(!u(r))throw new TypeError("invalid argument. Second argument must be a nonnegative integer. Value: `"+r+"`.");if(i=r,arguments.length>2){if(!u(n))throw new TypeError("invalid argument. Third argument must be a nonnegative integer. Value: `"+n+"`.");g=n}else g=p}else i=v,g=p;return c=g-i,h=-1,a(t={},"next",j),a(t,"return",w),f&&s(e[f])&&a(t,f,y),t;function j(){var r,n;if(h+=1,c>0&&h<i)for(h=0;h<i;h++)o=e.next().done;return c-=1,o||c<0?{done:!0}:(n=e.next()).done?(o=!0,r={},m(n,"value")&&(r.value=n.value),r.done=!0,r):{value:n.value,done:!1}}function w(e){return o=!0,arguments.length?{value:e,done:!0}:{done:!0}}function y(){return d(e[f](),i,g)}}var g=d;export default g;
//# sourceMappingURL=slice.js.map