UNPKG

@stdlib/esm

Version:

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

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