@stdlib/stats-base-dists-frechet-quantile 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
  # Quantile Function
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] -->
@@ -205,7 +216,7 @@ See [LICENSE][stdlib-license].
205
216
 
206
217
  ## Copyright
207
218
 
208
- Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
219
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
209
220
 
210
221
  </section>
211
222
 
@@ -218,8 +229,8 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
218
229
  [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-frechet-quantile.svg
219
230
  [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-frechet-quantile
220
231
 
221
- [test-image]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/actions/workflows/test.yml/badge.svg?branch=v0.0.7
222
- [test-url]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/actions/workflows/test.yml?query=branch:v0.0.7
232
+ [test-image]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/actions/workflows/test.yml/badge.svg?branch=v0.2.0
233
+ [test-url]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/actions/workflows/test.yml?query=branch:v0.2.0
223
234
 
224
235
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-frechet-quantile/main.svg
225
236
  [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-frechet-quantile?branch=main
@@ -232,7 +243,7 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
232
243
  -->
233
244
 
234
245
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
235
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
246
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
236
247
 
237
248
  [stdlib]: https://github.com/stdlib-js/stdlib
238
249
 
@@ -242,8 +253,11 @@ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
242
253
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
243
254
 
244
255
  [deno-url]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/tree/deno
256
+ [deno-readme]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/blob/deno/README.md
245
257
  [umd-url]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/tree/umd
258
+ [umd-readme]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/blob/umd/README.md
246
259
  [esm-url]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/tree/esm
260
+ [esm-readme]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/blob/esm/README.md
247
261
  [branches-url]: https://github.com/stdlib-js/stats-base-dists-frechet-quantile/blob/main/branches.md
248
262
 
249
263
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/stats-base-dists-frechet-quantile/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 quantile from '../docs/types/index';
3
+ export = quantile;
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";var o=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var c=o(function(g,q){
2
+ var u=require('@stdlib/math-base-assert-is-nan/dist'),N=require('@stdlib/math-base-special-pow/dist'),y=require('@stdlib/math-base-special-ln/dist');function x(e,r,t,n){return u(e)||u(r)||u(t)||u(n)||e<0||e>1||r<=0||t<=0?NaN:n+t*N(-y(e),-1/r)}q.exports=x
3
+ });var f=o(function(j,v){
4
+ var w=require('@stdlib/utils-constant-function/dist'),a=require('@stdlib/math-base-assert-is-nan/dist'),d=require('@stdlib/math-base-special-pow/dist'),l=require('@stdlib/math-base-special-ln/dist');function F(e,r,t){if(a(e)||a(r)||a(t)||e<=0||r<=0)return w(NaN);return n;function n(i){return a(i)||i<0||i>1?NaN:t+r*d(-l(i),-1/e)}}v.exports=F
5
+ });var O=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),s=c(),R=f();O(s,"factory",R);module.exports=s;
6
+ /** @license Apache-2.0 */
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/factory.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 pow = require( '@stdlib/math-base-special-pow' );\nvar ln = require( '@stdlib/math-base-special-ln' );\n\n\n// MAIN //\n\n/**\n* Evaluates the quantile function for a Fr\u00E9chet distribution with shape `alpha`, scale `s`, and location `m` at a probability `p`.\n*\n* @param {number} p - input probability\n* @param {PositiveNumber} alpha - shape parameter\n* @param {PositiveNumber} s - scale parameter\n* @param {number} m - location parameter\n* @returns {number} evaluated quantile function\n*\n* @example\n* var y = quantile( 0.5, 2.0, 3.0, 2.0 );\n* // returns ~5.603\n*\n* @example\n* var y = quantile( 0.2, 1.0, 3.0, -1.0 );\n* // returns ~0.864\n*\n* @example\n* var y = quantile( 0.3, 2.0, 1.0, 1.0 );\n* // returns ~1.911\n*\n* @example\n* var y = quantile( NaN, 2.0, 1.0, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = quantile( 0.1, NaN, 1.0, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = quantile( 0.1, 2.0, NaN, -1.0 );\n* // returns NaN\n*\n* @example\n* var y = quantile( 0.1, 2.0, 1.0, NaN );\n* // returns NaN\n*\n* @example\n* var y = quantile( 0.1, -1.0, 1.0, 0.0 );\n* // returns NaN\n*\n* @example\n* var y = quantile( 0.1, 1.0, -1.0, 0.0 );\n* // returns NaN\n*/\nfunction quantile( p, alpha, s, m ) {\n\tif (\n\t\tisnan( p ) ||\n\t\tisnan( alpha ) ||\n\t\tisnan( s ) ||\n\t\tisnan( m ) ||\n\t\tp < 0.0 ||\n\t\tp > 1.0 ||\n\t\talpha <= 0.0 ||\n\t\ts <= 0.0\n\t) {\n\t\treturn NaN;\n\t}\n\treturn m + ( s * ( pow( -ln( p ), -1.0/alpha ) ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = quantile;\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// MODULES //\n\nvar constantFunction = require( '@stdlib/utils-constant-function' );\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar pow = require( '@stdlib/math-base-special-pow' );\nvar ln = require( '@stdlib/math-base-special-ln' );\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the quantile function for a Fr\u00E9chet distribution with shape `alpha`, scale `s`, and location `m`.\n*\n* @param {PositiveNumber} alpha - shape parameter\n* @param {PositiveNumber} s - scale parameter\n* @param {number} m - location parameter\n* @returns {Function} quantile function\n*\n* @example\n* var quantile = factory( 3.0, 3.0, 5.0 );\n*\n* var y = quantile( 0.8 );\n* // returns ~9.946\n*\n* y = quantile( 0.2 );\n* // returns ~7.56\n*/\nfunction factory( alpha, s, m ) {\n\tif (\n\t\tisnan( alpha ) ||\n\t\tisnan( s ) ||\n\t\tisnan( m ) ||\n\t\talpha <= 0.0 ||\n\t\ts <= 0.0\n\t) {\n\t\treturn constantFunction( NaN );\n\t}\n\treturn quantile;\n\n\t/**\n\t* Evaluates the quantile function for a Fr\u00E9chet distribution.\n\t*\n\t* @private\n\t* @param {number} p - input probability\n\t* @returns {number} evaluated quantile function\n\t*\n\t* @example\n\t* var y = quantile( -2.0 );\n\t* // returns <number>\n\t*/\n\tfunction quantile( p ) {\n\t\tif ( isnan( p ) || p < 0.0 || p > 1.0 ) {\n\t\t\treturn NaN;\n\t\t}\n\t\treturn m + ( s * ( pow( -ln( p ), -1.0/alpha ) ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\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* Fr\u00E9chet distribution quantile function.\n*\n* @module @stdlib/stats-base-dists-frechet-quantile\n*\n* @example\n* var quantile = require( '@stdlib/stats-base-dists-frechet-quantile' );\n*\n* var y = quantile( 0.3, 2.0, 3.0, 5.0 );\n* // returns ~7.734\n*\n* y = quantile( 0.8, 2.0, 3.0, 2.0 );\n* // returns ~8.351\n*\n* @example\n* var factory = require( '@stdlib/stats-base-dists-frechet-quantile' ).factory;\n* var quantile = factory( 3.0, 3.0, 5.0 );\n* var y = quantile( 0.1 );\n* // returns ~7.272\n*\n* y = quantile( 0.8 );\n* // returns ~9.946\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EAC/CC,EAAK,QAAS,8BAA+B,EAkDjD,SAASC,EAAUC,EAAGC,EAAOC,EAAGC,EAAI,CACnC,OACCP,EAAOI,CAAE,GACTJ,EAAOK,CAAM,GACbL,EAAOM,CAAE,GACTN,EAAOO,CAAE,GACTH,EAAI,GACJA,EAAI,GACJC,GAAS,GACTC,GAAK,EAEE,IAEDC,EAAMD,EAAML,EAAK,CAACC,EAAIE,CAAE,EAAG,GAAKC,CAAM,CAC9C,CAKAN,EAAO,QAAUI,IC7FjB,IAAAK,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAmB,QAAS,iCAAkC,EAC9DC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EAC/CC,EAAK,QAAS,8BAA+B,EAsBjD,SAASC,EAASC,EAAOC,EAAGC,EAAI,CAC/B,GACCN,EAAOI,CAAM,GACbJ,EAAOK,CAAE,GACTL,EAAOM,CAAE,GACTF,GAAS,GACTC,GAAK,EAEL,OAAON,EAAkB,GAAI,EAE9B,OAAOQ,EAaP,SAASA,EAAUC,EAAI,CACtB,OAAKR,EAAOQ,CAAE,GAAKA,EAAI,GAAOA,EAAI,EAC1B,IAEDF,EAAMD,EAAMJ,EAAK,CAACC,EAAIM,CAAE,EAAG,GAAKJ,CAAM,CAC9C,CACD,CAKAN,EAAO,QAAUK,ICnCjB,IAAIM,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "isnan", "pow", "ln", "quantile", "p", "alpha", "s", "m", "require_factory", "__commonJSMin", "exports", "module", "constantFunction", "isnan", "pow", "ln", "factory", "alpha", "s", "m", "quantile", "p", "setReadOnly", "main", "factory"]
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
  * Evaluates the quantile function for a Fréchet distribution.
package/lib/index.js CHANGED
@@ -45,15 +45,15 @@
45
45
  // MODULES //
46
46
 
47
47
  var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
48
- var quantile = require( './quantile.js' );
48
+ var main = require( './main.js' );
49
49
  var factory = require( './factory.js' );
50
50
 
51
51
 
52
52
  // MAIN //
53
53
 
54
- setReadOnly( quantile, 'factory', factory );
54
+ setReadOnly( main, 'factory', factory );
55
55
 
56
56
 
57
57
  // EXPORTS //
58
58
 
59
- module.exports = quantile;
59
+ module.exports = main;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/stats-base-dists-frechet-quantile",
3
- "version": "0.0.7",
3
+ "version": "0.2.0",
4
4
  "description": "Fréchet distribution quantile function.",
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-nan": "^0.0.x",
41
- "@stdlib/math-base-special-ln": "^0.0.x",
42
- "@stdlib/math-base-special-pow": "^0.0.x",
43
- "@stdlib/utils-constant-function": "^0.0.x",
44
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x"
40
+ "@stdlib/math-base-assert-is-nan": "^0.2.0",
41
+ "@stdlib/math-base-special-ln": "^0.2.0",
42
+ "@stdlib/math-base-special-pow": "^0.2.0",
43
+ "@stdlib/utils-constant-function": "^0.2.0",
44
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@stdlib/bench": "^0.0.x",
48
- "@stdlib/constants-float64-eps": "^0.0.x",
49
- "@stdlib/constants-float64-ninf": "^0.0.x",
50
- "@stdlib/constants-float64-pinf": "^0.0.x",
51
- "@stdlib/math-base-special-abs": "^0.0.x",
52
- "@stdlib/random-base-randu": "^0.0.x",
47
+ "@stdlib/constants-float64-eps": "^0.1.1",
48
+ "@stdlib/constants-float64-ninf": "^0.1.1",
49
+ "@stdlib/constants-float64-pinf": "^0.1.1",
50
+ "@stdlib/math-base-special-abs": "^0.1.1",
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",
@@ -88,7 +89,7 @@
88
89
  "continuous"
89
90
  ],
90
91
  "funding": {
91
- "type": "patreon",
92
- "url": "https://www.patreon.com/athan"
92
+ "type": "opencollective",
93
+ "url": "https://opencollective.com/stdlib"
93
94
  }
94
95
  }
package/docs/repl.txt DELETED
@@ -1,84 +0,0 @@
1
-
2
- {{alias}}( p, α, s, m )
3
- Evaluates the quantile function for a Fréchet distribution with shape
4
- parameter `α`, scale parameter `s`, and location `m`.
5
-
6
- If `p < 0` or `p > 1`, the function returns `NaN`.
7
-
8
- If provided `NaN` as any argument, the function returns `NaN`.
9
-
10
- If provided `α <= 0` or `s <= 0`, the function returns `NaN`.
11
-
12
- Parameters
13
- ----------
14
- p: number
15
- Input probability.
16
-
17
- α: number
18
- Shape parameter.
19
-
20
- s: number
21
- Scale parameter.
22
-
23
- m: number
24
- Location parameter.
25
-
26
- Returns
27
- -------
28
- out: number
29
- Evaluated quantile function.
30
-
31
- Examples
32
- --------
33
- > var y = {{alias}}( 0.3, 10.0, 2.0, 3.0 )
34
- ~4.963
35
- > y = {{alias}}( 0.2, 3.0, 3.0, 3.0 )
36
- ~5.56
37
- > y = {{alias}}( 0.9, 1.0, 1.0, -3.0 )
38
- ~6.491
39
- > y = {{alias}}( NaN, 1.0, 1.0, 0.0 )
40
- NaN
41
- > y = {{alias}}( 0.0, NaN, 1.0, 0.0)
42
- NaN
43
- > y = {{alias}}( 0.0, 1.0, NaN, 0.0 )
44
- NaN
45
- > y = {{alias}}( 0.0, 1.0, 1.0, NaN )
46
- NaN
47
- > y = {{alias}}( 0.0, -1.0, 1.0, 0.0 )
48
- NaN
49
- > y = {{alias}}( 0.0, 1.0, -1.0, 0.0 )
50
- NaN
51
-
52
-
53
- {{alias}}.factory( α, s, m )
54
- Returns a function for evaluating the quantile function of a Fréchet
55
- distribution with shape parameter `α`, scale parameter `s`, and location
56
- `m`.
57
-
58
- Parameters
59
- ----------
60
- α: number
61
- Shape parameter.
62
-
63
- s: number
64
- Scale parameter.
65
-
66
- m: number
67
- Location parameter.
68
-
69
- Returns
70
- -------
71
- quantile: Function
72
- Quantile function.
73
-
74
- Examples
75
- --------
76
- > var myQuantile = {{alias}}.factory( 2.0, 2.0, 3.0 );
77
- > var y = myQuantile( 0.5 )
78
- ~5.402
79
- > y = myQuantile( 0.2 )
80
- ~4.576
81
-
82
- See Also
83
- --------
84
-
@@ -1,141 +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 quantile = require( './index' );
20
-
21
-
22
- // TESTS //
23
-
24
- // The function returns a number...
25
- {
26
- quantile( 0.2, 0, 4, 0.5 ); // $ExpectType number
27
- quantile( 0.1, 2, 8, 0.4 ); // $ExpectType number
28
- }
29
-
30
- // The compiler throws an error if the function is provided values other than four numbers...
31
- {
32
- quantile( true, 3, 6, -5 ); // $ExpectError
33
- quantile( false, 2, 4, -3 ); // $ExpectError
34
- quantile( '5', 1, 2, 0 ); // $ExpectError
35
- quantile( [], 1, 2, 0 ); // $ExpectError
36
- quantile( {}, 2, 4, 3 ); // $ExpectError
37
- quantile( ( x: number ): number => x, 2, 4, 3 ); // $ExpectError
38
-
39
- quantile( 0.9, true, 12, 9 ); // $ExpectError
40
- quantile( 0.9, false, 12, 9 ); // $ExpectError
41
- quantile( 0.5, '5', 10, 7 ); // $ExpectError
42
- quantile( 0.8, [], 16, 10 ); // $ExpectError
43
- quantile( 0.9, {}, 18, 10 ); // $ExpectError
44
- quantile( 0.8, ( x: number ): number => x, 16, 10 ); // $ExpectError
45
-
46
- quantile( 0.9, 5, true, 8 ); // $ExpectError
47
- quantile( 0.9, 5, false, 8 ); // $ExpectError
48
- quantile( 0.5, 2, '5', 4 ); // $ExpectError
49
- quantile( 0.8, 4, [], 6 ); // $ExpectError
50
- quantile( 0.9, 4, {}, 6 ); // $ExpectError
51
- quantile( 0.8, 5, ( x: number ): number => x, 8 ); // $ExpectError
52
-
53
- quantile( 0.9, 5, 10, true ); // $ExpectError
54
- quantile( 0.9, 5, 10, false ); // $ExpectError
55
- quantile( 0.5, 2, 4, '5' ); // $ExpectError
56
- quantile( 0.8, 4, 8, [] ); // $ExpectError
57
- quantile( 0.9, 4, 8, {} ); // $ExpectError
58
- quantile( 0.8, 5, 10, ( x: number ): number => x ); // $ExpectError
59
- }
60
-
61
- // The compiler throws an error if the function is provided an unsupported number of arguments...
62
- {
63
- quantile(); // $ExpectError
64
- quantile( 0.2 ); // $ExpectError
65
- quantile( 0.2, 0 ); // $ExpectError
66
- quantile( 0.2, 0, 4 ); // $ExpectError
67
- quantile( 0.2, 0, 4, 1, 7 ); // $ExpectError
68
- }
69
-
70
- // Attached to main export is a `factory` method which returns a function...
71
- {
72
- quantile.factory( 0, 4, 0.3 ); // $ExpectType Unary
73
- }
74
-
75
- // The `factory` method returns a function which returns a number...
76
- {
77
- const fcn = quantile.factory( 3, 7, 0.4 );
78
- fcn( 0.2 ); // $ExpectType number
79
- }
80
-
81
- // The compiler throws an error if the function returned by the `factory` method is provided invalid arguments...
82
- {
83
- const fcn = quantile.factory( 3, 7, 0.4 );
84
- fcn( true ); // $ExpectError
85
- fcn( false ); // $ExpectError
86
- fcn( '5' ); // $ExpectError
87
- fcn( [] ); // $ExpectError
88
- fcn( {} ); // $ExpectError
89
- fcn( ( x: number ): number => x ); // $ExpectError
90
- }
91
-
92
- // The compiler throws an error if the function returned by the `factory` method is provided an unsupported number of arguments...
93
- {
94
- const fcn = quantile.factory( 3, 7, 0.4 );
95
- fcn(); // $ExpectError
96
- fcn( 0.2, 0 ); // $ExpectError
97
- fcn( 0.2, 0, 1 ); // $ExpectError
98
- }
99
-
100
- // The compiler throws an error if the `factory` method is provided values other than three numbers...
101
- {
102
- quantile.factory( true, 3, 2 ); // $ExpectError
103
- quantile.factory( false, 2, 1.5 ); // $ExpectError
104
- quantile.factory( '5', 3, 1 ); // $ExpectError
105
- quantile.factory( [], 3, 1 ); // $ExpectError
106
- quantile.factory( {}, 4, 2 ); // $ExpectError
107
- quantile.factory( ( x: number ): number => x, 4, 2 ); // $ExpectError
108
-
109
- quantile.factory( 9, true, 11 ); // $ExpectError
110
- quantile.factory( 9, false, 11 ); // $ExpectError
111
- quantile.factory( 5, '5', 7 ); // $ExpectError
112
- quantile.factory( 8, [], 10 ); // $ExpectError
113
- quantile.factory( 9, {}, 11 ); // $ExpectError
114
- quantile.factory( 8, ( x: number ): number => x, 12 ); // $ExpectError
115
-
116
- quantile.factory( 9, 18, true ); // $ExpectError
117
- quantile.factory( 9, 18, false ); // $ExpectError
118
- quantile.factory( 5, 10, '5' ); // $ExpectError
119
- quantile.factory( 8, 16, [] ); // $ExpectError
120
- quantile.factory( 9, 18, {} ); // $ExpectError
121
- quantile.factory( 8, 16, ( x: number ): number => x ); // $ExpectError
122
-
123
- quantile.factory( [], true, 4 ); // $ExpectError
124
- quantile.factory( {}, false, 4 ); // $ExpectError
125
- quantile.factory( false, '5', 8 ); // $ExpectError
126
- quantile.factory( {}, [], 7 ); // $ExpectError
127
- quantile.factory( '5', ( x: number ): number => x, 7 ); // $ExpectError
128
-
129
- quantile.factory( [], true, [] ); // $ExpectError
130
- quantile.factory( {}, false, true ); // $ExpectError
131
- quantile.factory( false, '5', {} ); // $ExpectError
132
- quantile.factory( {}, [], 'abc' ); // $ExpectError
133
- quantile.factory( '5', ( x: number ): number => x, ( x: number ): number => x ); // $ExpectError
134
- }
135
-
136
- // The compiler throws an error if the `factory` method is provided an unsupported number of arguments...
137
- {
138
- quantile.factory( 0 ); // $ExpectError
139
- quantile.factory( 0, 4 ); // $ExpectError
140
- quantile.factory( 0, 9, 3, 5 ); // $ExpectError
141
- }
File without changes