UNPKG

@stdlib/esm

Version:

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

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