UNPKG

@stdlib/esm

Version:

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

3 lines 1 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/has-own-property.js";import t from"./../assert/is-plain-object.js";import n from"./../assert/is-nonnegative-integer.js";import i from"./../symbol/iterator.js";var o=e,a=r,s=t,u=n.isPrimitive,m=i;function p(e){var r,t,n,i,f;if(t={iter:1e308},arguments.length>1){if(!s(r=arguments[1]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.");if(a(r,"iter")&&(t.iter=r.iter,!u(r.iter)))throw new TypeError("invalid option. `iter` option must be a nonnegative integer. Option: `"+r.iter+"`.")}return f=0,o(n={},"next",l),o(n,"return",v),m&&o(n,m,d),n;function l(){return f+=1,i||f>t.iter?{done:!0}:{value:e,done:!1}}function v(e){return i=!0,arguments.length?{value:e,done:!0}:{done:!0}}function d(){return p(e,t)}}var f=p;export default f; //# sourceMappingURL=constant.js.map