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