UNPKG

@stdlib/esm

Version:

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

3 lines 1.84 kB
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 import r from"./../../../utils/define-nonenumerable-read-only-property.js";import e from"./../../../assert/is-function.js";import n from"./../../../assert/is-iterator-like.js";import t from"./../../../assert/is-number.js";import o from"./../../../assert/has-own-property.js";import i from"./../../../symbol/iterator.js";import a from"./../../../assert/is-plain-object.js";var u=a,l=o;function s(r,e){return u(e)?(l(e,"invalid")&&(r.invalid=e.invalid),null):new TypeError("invalid argument. Options argument must be an object. Value: `"+e+"`.")}var f=r,m=e,p=n,v=t.isPrimitive,d=o,c=i,h=s;function b(r,e,n,t,o){var i,a,u,l,s,j,y,g,w;for(l=3,a=[0,0,0],i=[],u=[],w=0;w<l;w++)if(i.push(arguments[w]),p(arguments[w]))u.push(1);else{if(!v(arguments[w]))throw new TypeError("invalid argument. Must provide an iterator protocol-compliant object or a number. Argument: `"+w+"`. Value: `"+arguments[w]+"`.");u.push(0)}if(!m(t))throw new TypeError("invalid argument. Third argument must be a function. Value: `"+t+"`.");if(j={invalid:NaN},arguments.length>4&&(g=h(j,o)))throw g;if(f(s={},"next",T),f(s,"return",x),c){for(w=0;w<l;w++)if(u[w]&&!m(i[w][c])){y=!0;break}y||f(s,c,E)}return y=0,s;function T(){var r,e,n;if(y)return{done:!0};for(y=0,r=0,n=0;n<l;n++)if(u[n]){if((e=i[n].next()).done){if(y+=1,d(e,"value")){"number"==typeof e.value?a[n]=e.value:r=1;continue}return{done:!0}}"number"==typeof e.value?a[n]=e.value:r=1}else a[n]=i[n];return r?{value:j.invalid,done:!1}:{value:t(a[0],a[1],a[2]),done:!1}}function x(r){return y=1,arguments.length?{value:r,done:!0}:{done:!0}}function E(){var r,e;for(r=[],e=0;e<l;e++)u[e]?r.push(i[e][c]()):r.push(i[e]);return r.push(t,j),b.apply(null,r)}}var j=b;export default j; //# sourceMappingURL=map3.js.map