UNPKG

@stdlib/esm

Version:

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

3 lines 1.06 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 n from"./../assert/is-function.js";import r from"./../assert/is-array-like-object.js";import t from"./../symbol/iterator.js";var o=e,a=n,u=r,i=t;function l(e){var n,r,t,f,m,s;if(!u(e))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+e+"`.");if(arguments.length>1){if(!a(f=arguments[1]))throw new TypeError("invalid argument. Second argument must be a function. Value: `"+f+"`.");n=arguments[2]}return m=e.length,s=m,o(r={},"next",f?d:c),o(r,"return",g),i&&o(r,i,h),r;function d(){return s+=e.length-m-1,m=e.length,t||s<0?(t=!0,{done:!0}):{value:f.call(n,e[s],s,e),done:!1}}function c(){return s+=e.length-m-1,m=e.length,t||s<0?(t=!0,{done:!0}):{value:e[s],done:!1}}function g(e){return t=!0,arguments.length?{value:e,done:!0}:{done:!0}}function h(){return f?l(e,f,n):l(e)}}var f=l;export default f; //# sourceMappingURL=to-iterator-right.js.map