@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 2.3 kB
JavaScript
// 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 t from"./../../utils/define-nonenumerable-read-only-accessor.js";import r from"./../../utils/define-nonenumerable-read-write-accessor.js";import n from"./../../utils/constant-function.js";import i from"./../../utils/noop.js";import o from"./../../utils/copy.js";import s from"./../../assert/is-positive-number.js";import a from"./../../assert/is-plain-object.js";import u from"./../../assert/is-nonnegative-integer.js";import m from"./../../assert/is-positive-integer.js";import l from"./../../assert/has-own-property.js";import f from"./../../constants/math/float64-max.js";import p from"./../base/erlang.js";import g from"./../../symbol/iterator.js";var c=e,d=t,v=r,h=n,b=i,j=o,y=s.isPrimitive,P=a,w=u.isPrimitive,L=m.isPrimitive,G=l,N=f,R=p.factory,E=g;function T(e,t,r){var n,i,o,s,a;if(!L(e))throw new TypeError("invalid argument. First argument must be a positive integer. Value: `"+e+"`.");if(!y(t))throw new TypeError("invalid argument. Second argument must be a positive number. Value: `"+t+"`.");if(arguments.length>2){if(!P(r))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.");if(n=j(r,1),G(n,"iter")){if(!w(n.iter))throw new TypeError("invalid option. `iter` option must be a nonnegative integer. Option: `"+n.iter+"`.")}else n.iter=N;o=R(e,t,n),void 0===n.prng&&!1!==n.copy&&(n.state=o.state)}else o=R(e,t),n={iter:N,state:o.state};return a=0,c(i={},"next",u),c(i,"return",m),n&&n.prng?(c(i,"seed",null),c(i,"seedLength",null),v(i,"state",h(null),b),c(i,"stateLength",null),c(i,"byteLength",null)):(d(i,"seed",f),d(i,"seedLength",p),v(i,"state",V,O),d(i,"stateLength",g),d(i,"byteLength",x)),c(i,"PRNG",o.PRNG),E&&c(i,E,l),i;function u(){return a+=1,s||a>n.iter?{done:!0}:{value:o(),done:!1}}function m(e){return s=!0,arguments.length?{value:e,done:!0}:{done:!0}}function l(){return T(e,t,n)}function f(){return o.PRNG.seed}function p(){return o.PRNG.seedLength}function g(){return o.PRNG.stateLength}function x(){return o.PRNG.byteLength}function V(){return o.PRNG.state}function O(e){o.PRNG.state=e}}var x=T;export default x;
//# sourceMappingURL=erlang.js.map