@stdlib/stats-base-dists-discrete-uniform-variance 0.0.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2022 The Stdlib Authors.
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # Variance
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -191,7 +202,7 @@ See [LICENSE][stdlib-license].
191
202
 
192
203
  ## Copyright
193
204
 
194
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
205
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
195
206
 
196
207
  </section>
197
208
 
@@ -204,8 +215,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
204
215
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-discrete-uniform-variance.svg
205
216
  [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-discrete-uniform-variance
206
217
 
207
- [test-image]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/actions/workflows/test.yml/badge.svg?branch=v0.0.7
208
- [test-url]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/actions/workflows/test.yml?query=branch:v0.0.7
218
+ [test-image]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/actions/workflows/test.yml/badge.svg?branch=v0.2.0
219
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/actions/workflows/test.yml?query=branch:v0.2.0
209
220
 
210
221
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-discrete-uniform-variance/main.svg
211
222
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-discrete-uniform-variance?branch=main
@@ -218,7 +229,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
218
229
  -->
219
230
 
220
231
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
221
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
232
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
222
233
 
223
234
  [stdlib]: https://github.com/stdlib-js/stdlib
224
235
 
@@ -228,8 +239,11 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
228
239
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
229
240
 
230
241
  [deno-url]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/tree/deno
242
+ [deno-readme]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/blob/deno/README.md
231
243
  [umd-url]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/tree/umd
244
+ [umd-readme]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/blob/umd/README.md
232
245
  [esm-url]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/tree/esm
246
+ [esm-readme]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/blob/esm/README.md
233
247
  [branches-url]: https://github.com/stdlib-js/stats-base-dists-discrete-uniform-variance/blob/main/branches.md
234
248
 
235
249
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats-base-dists-discrete-uniform-variance/main/LICENSE
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import variance from '../docs/types/index';
3
+ export = variance;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var s=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var u=s(function(q,n){
2
+ var i=require('@stdlib/math-base-assert-is-nan/dist'),t=require('@stdlib/math-base-assert-is-integer/dist'),a=require('@stdlib/math-base-special-pow/dist');function v(e,r){return i(e)||i(r)||!t(e)||!t(r)||e>r?NaN:(a(r-e+1,2)-1)/12}n.exports=v
3
+ });var c=u();module.exports=c;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar pow = require( '@stdlib/math-base-special-pow' );\n\n\n// MAIN //\n\n/**\n* Returns the variance of a discrete uniform distribution.\n*\n* @param {integer} a - minimum support\n* @param {integer} b - maximum support\n* @returns {PositiveNumber} variance\n*\n* @example\n* var v = variance( 0, 1 );\n* // returns ~0.25\n*\n* @example\n* var v = variance( 4, 12 );\n* // returns ~6.667\n*\n* @example\n* var v = variance( -4, 4 );\n* // returns ~6.667\n*\n* @example\n* var v = variance( 1, -0.1 );\n* // returns NaN\n*\n* @example\n* var v = variance( 0.5, 1 );\n* // returns NaN\n*\n* @example\n* var v = variance( 2, NaN );\n* // returns NaN\n*\n* @example\n* var v = variance( NaN, 2 );\n* // returns NaN\n*/\nfunction variance( a, b ) {\n\tif (\n\t\tisnan( a ) ||\n\t\tisnan( b ) ||\n\t\t!isInteger( a ) ||\n\t\t!isInteger( b ) ||\n\t\ta > b\n\t) {\n\t\treturn NaN;\n\t}\n\treturn ( pow( b-a+1, 2.0 ) - 1.0 ) / 12.0;\n}\n\n\n// EXPORTS //\n\nmodule.exports = variance;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Discrete uniform distribution variance.\n*\n* @module @stdlib/stats-base-dists-discrete-uniform-variance\n*\n* @example\n* var variance = require( '@stdlib/stats-base-dists-discrete-uniform-variance' );\n*\n* var v = variance( 0, 1 );\n* // returns ~0.25\n*\n* v = variance( 4, 12 );\n* // returns ~6.667\n*\n* v = variance( 2, 8 );\n* // returns 4.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EACnDC,EAAY,QAAS,qCAAsC,EAC3DC,EAAM,QAAS,+BAAgC,EAwCnD,SAASC,EAAUC,EAAGC,EAAI,CACzB,OACCL,EAAOI,CAAE,GACTJ,EAAOK,CAAE,GACT,CAACJ,EAAWG,CAAE,GACd,CAACH,EAAWI,CAAE,GACdD,EAAIC,EAEG,KAECH,EAAKG,EAAED,EAAE,EAAG,CAAI,EAAI,GAAQ,EACtC,CAKAL,EAAO,QAAUI,ICxCjB,IAAIG,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "isnan", "isInteger", "pow", "variance", "a", "b", "main"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /**
22
22
  * Returns the variance of a discrete uniform distribution.
package/lib/index.js CHANGED
@@ -38,9 +38,9 @@
38
38
 
39
39
  // MODULES //
40
40
 
41
- var variance = require( './variance.js' );
41
+ var main = require( './main.js' );
42
42
 
43
43
 
44
44
  // EXPORTS //
45
45
 
46
- module.exports = variance;
46
+ module.exports = main;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-base-dists-discrete-uniform-variance",
3
- "version": "0.0.7",
3
+ "version": "0.2.0",
4
4
  "description": "Discrete uniform distribution variance.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,22 +37,23 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/math-base-assert-is-integer": "^0.0.x",
41
- "@stdlib/math-base-assert-is-nan": "^0.0.x",
42
- "@stdlib/math-base-special-pow": "^0.0.x"
40
+ "@stdlib/math-base-assert-is-integer": "^0.2.0",
41
+ "@stdlib/math-base-assert-is-nan": "^0.2.0",
42
+ "@stdlib/math-base-special-pow": "^0.2.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@stdlib/bench": "^0.0.x",
46
- "@stdlib/constants-float64-eps": "^0.0.x",
47
- "@stdlib/constants-float64-ninf": "^0.0.x",
48
- "@stdlib/constants-float64-pinf": "^0.0.x",
49
- "@stdlib/math-base-special-abs": "^0.0.x",
50
- "@stdlib/math-base-special-round": "^0.0.x",
51
- "@stdlib/random-base-discrete-uniform": "^0.0.x",
52
- "@stdlib/random-base-randu": "^0.0.x",
45
+ "@stdlib/constants-float64-eps": "^0.1.1",
46
+ "@stdlib/constants-float64-ninf": "^0.1.1",
47
+ "@stdlib/constants-float64-pinf": "^0.1.1",
48
+ "@stdlib/math-base-special-abs": "^0.1.1",
49
+ "@stdlib/math-base-special-round": "^0.1.1",
50
+ "@stdlib/random-base-discrete-uniform": "^0.1.0",
51
+ "@stdlib/random-base-randu": "^0.1.0",
53
52
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
54
53
  "istanbul": "^0.4.1",
55
- "tap-spec": "5.x.x"
54
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
55
+ "@stdlib/bench-harness": "^0.2.0",
56
+ "@stdlib/bench": "^0.3.1"
56
57
  },
57
58
  "engines": {
58
59
  "node": ">=0.10.0",
@@ -86,7 +87,7 @@
86
87
  "uniform"
87
88
  ],
88
89
  "funding": {
89
- "type": "patreon",
90
- "url": "https://www.patreon.com/athan"
90
+ "type": "opencollective",
91
+ "url": "https://opencollective.com/stdlib"
91
92
  }
92
93
  }
package/docs/repl.txt DELETED
@@ -1,33 +0,0 @@
1
-
2
- {{alias}}( a, b )
3
- Returns the variance of a discrete uniform distribution.
4
-
5
- If `a > b`, the function returns `NaN`.
6
-
7
- If `a` or `b` is not an integer value, the function returns `NaN`.
8
-
9
- Parameters
10
- ----------
11
- a: integer
12
- Minimum support.
13
-
14
- b: integer
15
- Maximum support.
16
-
17
- Returns
18
- -------
19
- out: number
20
- Variance.
21
-
22
- Examples
23
- --------
24
- > var v = {{alias}}( 0, 1 )
25
- ~0.25
26
- > v = {{alias}}( 4, 12 )
27
- ~6.667
28
- > v = {{alias}}( 2, 8 )
29
- 4.0
30
-
31
- See Also
32
- --------
33
-
@@ -1,56 +0,0 @@
1
- /*
2
- * @license Apache-2.0
3
- *
4
- * Copyright (c) 2019 The Stdlib Authors.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- import variance = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a number...
25
- {
26
- variance( 2, 4 ); // $ExpectType number
27
- }
28
-
29
- // The function does not compile if provided values other than two numbers...
30
- {
31
- variance( true, 3 ); // $ExpectError
32
- variance( false, 2 ); // $ExpectError
33
- variance( '5', 1 ); // $ExpectError
34
- variance( [], 1 ); // $ExpectError
35
- variance( {}, 2 ); // $ExpectError
36
- variance( ( x: number ): number => x, 2 ); // $ExpectError
37
-
38
- variance( 9, true ); // $ExpectError
39
- variance( 9, false ); // $ExpectError
40
- variance( 5, '5' ); // $ExpectError
41
- variance( 8, [] ); // $ExpectError
42
- variance( 9, {} ); // $ExpectError
43
- variance( 8, ( x: number ): number => x ); // $ExpectError
44
-
45
- variance( [], true ); // $ExpectError
46
- variance( {}, false ); // $ExpectError
47
- variance( false, '5' ); // $ExpectError
48
- variance( {}, [] ); // $ExpectError
49
- variance( '5', ( x: number ): number => x ); // $ExpectError
50
- }
51
-
52
- // The function does not compile if provided insufficient arguments...
53
- {
54
- variance(); // $ExpectError
55
- variance( 3 ); // $ExpectError
56
- }
File without changes