@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 2.44 kB
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import t from"./../../../../assert/is-positive-integer.js";import r from"./../../../../assert/is-probability.js";import e from"./../../../../utils/define-property.js";import i from"./../../../../utils/define-nonenumerable-read-only-property.js";import n from"./../../../../utils/define-nonenumerable-read-only-accessor.js";import o from"./kurtosis.js";import s from"./mean.js";import p from"./median.js";import u from"./mode.js";import m from"./skewness.js";import f from"./stdev.js";import a from"./variance.js";import h from"./cdf.js";import l from"./logpmf.js";import c from"./mgf.js";import y from"./pmf.js";import d from"./quantile.js";var b=t.isPrimitive,v=r.isPrimitive,j=e,g=i,w=n,k=o,E=s,T=p,V=u,q=m,M=f,P=a,x=h,N=l,S=c,z=y,A=d;function B(t){return x(t,this.n,this.p)}function C(t){return N(t,this.n,this.p)}function D(t){return S(t,this.n,this.p)}function F(t){return z(t,this.n,this.p)}function G(t){return A(t,this.n,this.p)}function H(){var t,r;if(!(this instanceof H))return 0===arguments.length?new H:new H(arguments[0],arguments[1]);if(arguments.length){if(r=arguments[1],!b(t=arguments[0]))throw new TypeError("invalid argument. Number of trials `n` must be a positive integer. Value: `"+t+"`");if(!v(r))throw new TypeError("invalid argument. Success probability `p` must be a number between 0 and 1. Value: `"+r+"`")}else t=1,r=.5;return j(this,"n",{configurable:!1,enumerable:!0,get:function(){return t},set:function(r){if(!b(r))throw new TypeError("invalid value. Must be a positive integer. Value: `"+r+"`");t=r}}),j(this,"p",{configurable:!1,enumerable:!0,get:function(){return r},set:function(t){if(!v(t))throw new TypeError("invalid value. Must be a number between 0 and 1. Value: `"+t+"`");r=t}}),this}w(H.prototype,"kurtosis",(function(){return k(this.n,this.p)})),w(H.prototype,"mean",(function(){return E(this.n,this.p)})),w(H.prototype,"median",(function(){return T(this.n,this.p)})),w(H.prototype,"mode",(function(){return V(this.n,this.p)})),w(H.prototype,"skewness",(function(){return q(this.n,this.p)})),w(H.prototype,"stdev",(function(){return M(this.n,this.p)})),w(H.prototype,"variance",(function(){return P(this.n,this.p)})),g(H.prototype,"cdf",B),g(H.prototype,"logpmf",C),g(H.prototype,"mgf",D),g(H.prototype,"pmf",F),g(H.prototype,"quantile",G);var I=H;export default I;
//# sourceMappingURL=ctor.js.map