diff --git a/.editorconfig b/.editorconfig index 0fd4d6c..13e9c39 100644 --- a/.editorconfig +++ b/.editorconfig @@ -179,3 +179,8 @@ indent_size = 2 [*.gypi] indent_style = space indent_size = 2 + +# Set properties for citation files: +[*.{cff,cff.txt}] +indent_style = space +indent_size = 2 diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index a4ea843..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-08-01T06:06:20.241Z diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml index 334eb59..91f2b93 100644 --- a/.github/workflows/productionize.yml +++ b/.github/workflows/productionize.yml @@ -82,21 +82,6 @@ jobs: id: transform-error-messages uses: stdlib-js/transform-errors-action@main - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - name: 'Update dependencies in package.json' run: | diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..2ec6fff --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,30 @@ +cff-version: 1.2.0 +title: stdlib +message: >- + If you use this software, please cite it using the + metadata from this file. + +type: software + +authors: + - name: The Stdlib Authors + url: https://github.com/stdlib-js/stdlib/graphs/contributors + +repository-code: https://github.com/stdlib-js/stdlib +url: https://stdlib.io + +abstract: | + Standard library for JavaScript and Node.js. + +keywords: + - JavaScript + - Node.js + - TypeScript + - standard library + - scientific computing + - numerical computing + - statistical computing + +license: Apache-2.0 AND BSL-1.0 + +date-released: 2016 diff --git a/README.md b/README.md index 4da9398..7115ddf 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,17 @@ limitations under the License. --> + +
+ + About stdlib... + +

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.

+

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.

+

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.

+

To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!

+
+ # Cumulative Distribution Function [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] @@ -215,8 +226,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [npm-image]: http://img.shields.io/npm/v/@stdlib/stats-base-dists-triangular-cdf.svg [npm-url]: https://npmjs.org/package/@stdlib/stats-base-dists-triangular-cdf -[test-image]: https://github.com/stdlib-js/stats-base-dists-triangular-cdf/actions/workflows/test.yml/badge.svg?branch=main -[test-url]: https://github.com/stdlib-js/stats-base-dists-triangular-cdf/actions/workflows/test.yml?query=branch:main +[test-image]: https://github.com/stdlib-js/stats-base-dists-triangular-cdf/actions/workflows/test.yml/badge.svg?branch=v0.1.0 +[test-url]: https://github.com/stdlib-js/stats-base-dists-triangular-cdf/actions/workflows/test.yml?query=branch:v0.1.0 [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-base-dists-triangular-cdf/main.svg [coverage-url]: https://codecov.io/github/stdlib-js/stats-base-dists-triangular-cdf?branch=main diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..b3de6bd --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +/// +import cdf from '../docs/types/index'; +export = cdf; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..a6a933f --- /dev/null +++ b/dist/index.js @@ -0,0 +1,7 @@ +"use strict";var a=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var N=a(function(g,q){ +var o=require('@stdlib/math-base-assert-is-nan/dist'),v=require('@stdlib/math-base-special-pow/dist');function w(e,r,n,t){var u,f;return o(e)||o(r)||o(n)||o(t)||r>t||t>n?NaN:e<=r?0:(u=(n-r)*(t-r),f=(n-r)*(n-t),e<=t?v(e-r,2)/u:e c ||\n\t\tc > b\n\t) {\n\t\treturn NaN;\n\t}\n\tif ( x <= a ) {\n\t\treturn 0.0;\n\t}\n\tdenom1 = ( b - a ) * ( c - a );\n\tdenom2 = ( b - a ) * ( b - c );\n\n\t// Case: x > a\n\tif ( x <= c ) {\n\t\treturn pow( x - a, 2.0 ) / denom1;\n\t}\n\t// Case: x > c\n\tif ( x < b ) {\n\t\treturn 1.0 - ( pow( b - x, 2.0 ) / denom2 );\n\t}\n\t// Case: x >= b\n\treturn 1.0;\n}\n\n\n// EXPORTS //\n\nmodule.exports = cdf;\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' );\n\n\n// MAIN //\n\n/**\n* Returns a function for evaluating the cumulative distribution function (CDF) for a triangular distribution with lower limit `a` and upper limit `b` and mode `c`.\n*\n* @param {number} a - lower limit\n* @param {number} b - upper limit\n* @param {number} c - mode\n* @returns {Function} CDF\n*\n* @example\n* var cdf = factory( 0.0, 10.0, 2.0 );\n* var y = cdf( 0.5 );\n* // returns 0.0125\n*\n* y = cdf( 8.0 );\n* // returns 0.95\n*/\nfunction factory( a, b, c ) {\n\tvar denom1;\n\tvar denom2;\n\n\tif (\n\t\tisnan( a ) ||\n\t\tisnan( b ) ||\n\t\tisnan( c )\n\t) {\n\t\treturn constantFunction( NaN );\n\t}\n\tif ( !( a <= c && c <= b ) ) {\n\t\treturn constantFunction( NaN );\n\t}\n\n\tdenom1 = ( b - a ) * ( c - a );\n\tdenom2 = ( b - a ) * ( b - c );\n\treturn cdf;\n\n\t/**\n\t* Evaluates the cumulative distribution function (CDF) for a triangular distribution.\n\t*\n\t* @private\n\t* @param {number} x - input value\n\t* @returns {Probability} evaluated CDF\n\t*\n\t* @example\n\t* var y = cdf( 2.0 );\n\t* // returns \n\t*/\n\tfunction cdf( x ) {\n\t\tif ( isnan( x ) ) {\n\t\t\treturn NaN;\n\t\t}\n\t\tif ( x <= a ) {\n\t\t\treturn 0.0;\n\t\t}\n\t\t// Case: x > a\n\t\tif ( x <= c ) {\n\t\t\treturn pow( x - a, 2.0 ) / denom1;\n\t\t}\n\t\t// Case: x > c\n\t\tif ( x < b ) {\n\t\t\treturn 1 - ( pow( b - x, 2.0 ) / denom2 );\n\t\t}\n\t\t// Case: x >= b\n\t\treturn 1.0;\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* Triangular distribution cumulative distribution function (CDF).\n*\n* @module @stdlib/stats-base-dists-triangular-cdf\n*\n* @example\n* var cdf = require( '@stdlib/stats-base-dists-triangular-cdf' );\n*\n* var y = cdf( 0.5, -1.0, 1.0, 0.0 );\n* // returns 0.875\n*\n* y = cdf( 0.5, -1.0, 1.0, 0.5 );\n* // returns 0.75\n*\n* y = cdf( -10.0, -20.0, 0.0, -2.0 );\n* // returns ~0.278\n*\n* y = cdf( -2.0, -1.0, 1.0, 0.0 );\n* // returns 0.0\n*\n* var mycdf = cdf.factory( 0.0, 10.0, 2.0 );\n* y = mycdf( 0.5 );\n* // returns 0.0125\n*\n* y = mycdf( 8.0 );\n* // returns 0.95\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"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EAkDnD,SAASC,EAAKC,EAAGC,EAAGC,EAAGC,EAAI,CAC1B,IAAIC,EACAC,EAEJ,OACCR,EAAOG,CAAE,GACTH,EAAOI,CAAE,GACTJ,EAAOK,CAAE,GACTL,EAAOM,CAAE,GACTF,EAAIE,GACJA,EAAID,EAEG,IAEHF,GAAKC,EACF,GAERG,GAAWF,EAAID,IAAQE,EAAIF,GAC3BI,GAAWH,EAAID,IAAQC,EAAIC,GAGtBH,GAAKG,EACFL,EAAKE,EAAIC,EAAG,CAAI,EAAIG,EAGvBJ,EAAIE,EACD,EAAQJ,EAAKI,EAAIF,EAAG,CAAI,EAAIK,EAG7B,EACR,CAKAT,EAAO,QAAUG,IC5GjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAmB,QAAS,iCAAkC,EAC9DC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EAqBnD,SAASC,EAASC,EAAGC,EAAGC,EAAI,CAC3B,IAAIC,EACAC,EAEJ,GACCP,EAAOG,CAAE,GACTH,EAAOI,CAAE,GACTJ,EAAOK,CAAE,EAET,OAAON,EAAkB,GAAI,EAE9B,GAAK,EAAGI,GAAKE,GAAKA,GAAKD,GACtB,OAAOL,EAAkB,GAAI,EAG9B,OAAAO,GAAWF,EAAID,IAAQE,EAAIF,GAC3BI,GAAWH,EAAID,IAAQC,EAAIC,GACpBG,EAaP,SAASA,EAAKC,EAAI,CACjB,OAAKT,EAAOS,CAAE,EACN,IAEHA,GAAKN,EACF,EAGHM,GAAKJ,EACFJ,EAAKQ,EAAIN,EAAG,CAAI,EAAIG,EAGvBG,EAAIL,EACD,EAAMH,EAAKG,EAAIK,EAAG,CAAI,EAAIF,EAG3B,CACR,CACD,CAKAT,EAAO,QAAUI,IChDjB,IAAIQ,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD", + "names": ["require_main", "__commonJSMin", "exports", "module", "isnan", "pow", "cdf", "x", "a", "b", "c", "denom1", "denom2", "require_factory", "__commonJSMin", "exports", "module", "constantFunction", "isnan", "pow", "factory", "a", "b", "c", "denom1", "denom2", "cdf", "x", "setReadOnly", "main", "factory"] +} diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index 44927eb..4e810da 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -16,7 +16,7 @@ * limitations under the License. */ -// TypeScript Version: 2.0 +// TypeScript Version: 4.1 /** * Evaluates the cumulative distribution function (CDF) for a triangular distribution. diff --git a/package.json b/package.json index 8cb4604..10d28b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stdlib/stats-base-dists-triangular-cdf", - "version": "0.0.7", + "version": "0.1.0", "description": "Triangular distribution cumulative distribution function (CDF).", "license": "Apache-2.0", "author": { @@ -37,17 +37,17 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/utils-constant-function": "^0.0.8", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.7" + "@stdlib/math-base-assert-is-nan": "^0.1.0", + "@stdlib/math-base-special-pow": "^0.1.0", + "@stdlib/utils-constant-function": "^0.1.0", + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0" }, "devDependencies": { - "@stdlib/bench": "^0.0.12", - "@stdlib/constants-float64-eps": "^0.0.8", - "@stdlib/constants-float64-ninf": "^0.0.8", - "@stdlib/constants-float64-pinf": "^0.0.8", - "@stdlib/math-base-special-abs": "^0.0.6", + "@stdlib/bench": "^0.1.0", + "@stdlib/constants-float64-eps": "^0.1.0", + "@stdlib/constants-float64-ninf": "^0.1.0", + "@stdlib/constants-float64-pinf": "^0.1.0", + "@stdlib/math-base-special-abs": "^0.1.0", "@stdlib/random-base-randu": "^0.0.8", "tape": "git+https://github.com/kgryte/tape.git#fix/globby", "istanbul": "^0.4.1",