diff --git a/.gitattributes b/.gitattributes index 10a16e6..1c88e69 100644 --- a/.gitattributes +++ b/.gitattributes @@ -40,10 +40,27 @@ *.mov binary # Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false +/lib/node_modules/** -linguist-vendored -linguist-generated -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false +# Configure directories which should *not* be included in GitHub language statistics: +/deps/** linguist-vendored +/dist/** linguist-generated +/workshops/** linguist-vendored + +benchmark/** linguist-vendored +docs/* linguist-documentation +etc/** linguist-vendored +examples/** linguist-documentation +scripts/** linguist-vendored +test/** linguist-vendored +tools/** linguist-vendored + +# Configure files which should *not* be included in GitHub language statistics: +Makefile linguist-vendored +*.mk linguist-vendored +*.jl linguist-vendored +*.py linguist-vendored +*.R linguist-vendored + +# Configure files which should be included in GitHub language statistics: +docs/types/*.d.ts -linguist-documentation diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml index ec90164..f92a6c5 100644 --- a/.github/workflows/productionize.yml +++ b/.github/workflows/productionize.yml @@ -344,7 +344,6 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() @@ -518,7 +517,6 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() @@ -698,7 +696,6 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3eec50e..ad3a3e0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -218,7 +218,6 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27ad974..cbcace2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -95,6 +95,5 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() diff --git a/.github/workflows/test_bundles.yml b/.github/workflows/test_bundles.yml index 6d77abd..5b5879a 100644 --- a/.github/workflows/test_bundles.yml +++ b/.github/workflows/test_bundles.yml @@ -94,7 +94,6 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() @@ -139,7 +138,6 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() @@ -184,6 +182,5 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() diff --git a/.github/workflows/test_coverage.yml b/.github/workflows/test_coverage.yml index f4eda1e..2bcf0cd 100644 --- a/.github/workflows/test_coverage.yml +++ b/.github/workflows/test_coverage.yml @@ -119,7 +119,6 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 57f532b..183fd31 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -81,6 +81,5 @@ jobs: uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 with: status: ${{ job.status }} - steps: ${{ toJson(steps) }} channel: '#npm-ci' if: failure() diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 4500383..67abc19 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -5,6 +5,7 @@ Adarsh Palaskar Aditya Sapra AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com> +Aleksandr <112382387+alextes90@users.noreply.github.com> Ali Salesi Aman Bhansali Amit Jimiwal @@ -18,6 +19,7 @@ Chinmay Joshi <86140365+JawHawk@users.noreply.github.com> Christopher Dambamuromo Dan Rose Daniel Killenberger +Daniel Yu <40680511+Daniel777y@users.noreply.github.com> Dominik Moritz Dorrin Sotoudeh EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com> @@ -69,8 +71,11 @@ Seyyed Parsa Neshaei Shashank Shekhar Singh Shivam <11shivam00@gmail.com> Shraddheya Shendre +Shubh Mehta <93862397+Shubh942@users.noreply.github.com> Shubham Mishra +Sivam Das <100067002+Sivam2313@users.noreply.github.com> Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com> +Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com> Spandan Barve Stephannie Jiménez Gacha Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com> @@ -79,8 +84,10 @@ Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com> Utkarsh Utkarsh Raj Varad Gupta +Xiaochuan Ye Yernar Yergaziyev naveen nishant-s7 <97207366+nishant-s7@users.noreply.github.com> orimiles5 <97595296+orimiles5@users.noreply.github.com> +rainn <88160429+AmCodesLame@users.noreply.github.com> rei2hu diff --git a/dist/index.js.map b/dist/index.js.map index 8bbc132..7acd1c8 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../lib/main.js", "../lib/index.js"], - "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 isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar isInfinite = require( '@stdlib/math-base-assert-is-infinite' );\nvar frexp = require( '@stdlib/math-base-special-frexp' ).assign;\nvar ldexp = require( '@stdlib/math-base-special-ldexp' );\nvar Float64Array = require( '@stdlib/array-float64' );\nvar format = require( '@stdlib/string-format' );\n\n\n// FUNCTIONS //\n\n/**\n* Computes an updated product.\n*\n* @private\n* @param {Array} workspace - workspace array\n* @param {Object} acc - accumulated fractional and exponent parts\n* @param {number} x - multiplicative factor\n* @returns {number} product\n*/\nfunction product( workspace, acc, x ) {\n\t// Split the incoming value into a normalized fraction and exponent:\n\tfrexp( x, workspace, 1, 0 );\n\n\t// Update the accumulated fraction:\n\tacc.frac *= workspace[ 0 ];\n\n\t// Update the accumulated exponent:\n\tacc.exp += workspace[ 1 ];\n\n\t// Ensure fraction remains normalized to avoid overflow/underflow...\n\tif ( acc.frac > -0.5 && acc.frac < 0.5 ) {\n\t\tfrexp( acc.frac, workspace, 1, 0 );\n\t\tacc.frac = workspace[ 0 ];\n\t\tacc.exp += workspace[ 1 ];\n\t}\n\treturn ldexp( acc.frac, acc.exp );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accumulator function which incrementally computes a moving product.\n*\n* ## Method\n*\n* To avoid overflow/underflow, we store the fractional and exponent parts of intermediate results separately. By keeping a normalized fraction, we prevent underflow/overflow of the fraction. Underflow of the exponent is impossible, as IEEE 754 floating-point exponents are integer values. Overflow of the exponent is possible, but highly unlikely. In the worst case, an intermediate exponent is greater than the minimum safe integer, and adding the exponent of an incoming value does not change the intermediate result. While incorrect, such behavior does not lead to exponent overflow.\n*\n* While intermediate results are largely immune to overflow and not subject to underflow, this does not mean that returned results will never be zero or infinite. In fact, zero (underflow) and infinite (overflow) results may be transient (i.e., infinity followed by a finite number).\n*\n* ## References\n*\n* - Ueberhuber, Christoph W. 1997. _Numerical Computation 1: Methods, Software, and Analysis_. Springer-Verlag Berlin Heidelberg. doi:[10.1007/978-3-642-59118-1](https://doi.org/10.1007/978-3-642-59118-1).\n*\n* @param {PositiveInteger} W - window size\n* @throws {TypeError} must provide a positive integer\n* @returns {Function} accumulator function\n*\n* @example\n* var accumulator = incrmprod( 3 );\n*\n* var p = accumulator();\n* // returns null\n*\n* p = accumulator( 2.0 );\n* // returns 2.0\n*\n* p = accumulator( -5.0 );\n* // returns -10.0\n*\n* p = accumulator( 3.0 );\n* // returns -30.0\n*\n* p = accumulator( 5.0 );\n* // returns -75.0\n*\n* p = accumulator();\n* // returns -75.0\n*/\nfunction incrmprod( W ) {\n\tvar parts;\n\tvar prod;\n\tvar buf;\n\tvar acc;\n\tvar N;\n\tvar i;\n\tif ( !isPositiveInteger( W ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a positive integer. Value: `%s`.', W ) );\n\t}\n\tbuf = new Float64Array( W );\n\ti = -1;\n\tN = 0;\n\n\t// Initialize a workspace for `frexp`:\n\tparts = [ 0.0, 0 ];\n\n\t// Initial product is 1.0, which may be split into its fractional and exponent parts (0.5 x 2.0**1 = 1.0):\n\tprod = 1.0;\n\tacc = {};\n\tacc.frac = 0.5;\n\tacc.exp = 1.0;\n\n\treturn accumulator;\n\n\t/**\n\t* If provided a value, the accumulator function returns an updated prodct. If not provided a value, the accumulator function returns the current prodct.\n\t*\n\t* @private\n\t* @param {number} [x] - input value\n\t* @returns {(number|null)} product or null\n\t*/\n\tfunction accumulator( x ) {\n\t\tvar k;\n\t\tvar v;\n\t\tif ( arguments.length === 0 ) {\n\t\t\tif ( N === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn prod;\n\t\t}\n\t\t// Update the index for managing the circular buffer:\n\t\ti = (i+1) % W;\n\n\t\t// Case: incoming value is NaN, the accumulated value is automatically NaN...\n\t\tif ( isnan( x ) ) {\n\t\t\tN = W; // explicitly set to avoid `N < W` branch\n\t\t\tprod = NaN;\n\t\t}\n\t\t// Case: initial window...\n\t\telse if ( N < W ) {\n\t\t\tN += 1;\n\t\t\tprod = product( parts, acc, x );\n\t\t}\n\t\t// Case: outgoing value is a \"special\" value, and, thus, we need to compute the accumulated value...\n\t\telse if (\n\t\t\tbuf[ i ] === 0.0 ||\n\t\t\tisnan( buf[ i ] ) ||\n\t\t\tisInfinite( buf[ i ] )\n\t\t) {\n\t\t\tN = 1;\n\t\t\tacc.frac = 0.5;\n\t\t\tacc.exp = 1.0;\n\t\t\tproduct( parts, acc, x );\n\t\t\tfor ( k = 0; k < W; k++ ) {\n\t\t\t\tif ( k !== i ) {\n\t\t\t\t\tv = buf[ k ];\n\t\t\t\t\tif ( isnan( v ) ) {\n\t\t\t\t\t\tN = W; // explicitly set to avoid `N < W` branch\n\t\t\t\t\t\tprod = NaN;\n\t\t\t\t\t\tbreak; // product is automatically NaN, so no need to continue\n\t\t\t\t\t}\n\t\t\t\t\tN += 1;\n\t\t\t\t\tprod = product( parts, acc, v );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Case: neither the current accumulated value nor the incoming value are NaN, so we need to update the accumulated value...\n\t\telse if ( isnan( prod ) === false ) {\n\t\t\tv = x / buf[ i ];\n\t\t\tprod = product( parts, acc, v );\n\t\t}\n\t\t// Case: the current accumulated value is NaN, so nothing to do until the buffer no longer contains NaN values...\n\t\tbuf[ i ] = x;\n\n\t\treturn prod;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = incrmprod;\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* Compute a moving product incrementally.\n*\n* @module @stdlib/stats-incr-mprod\n*\n* @example\n* var incrmprod = require( '@stdlib/stats-incr-mprod' );\n*\n* var accumulator = incrmprod( 3 );\n*\n* var p = accumulator();\n* // returns null\n*\n* p = accumulator( 2.0 );\n* // returns 2.0\n*\n* p = accumulator( -5.0 );\n* // returns -10.0\n*\n* p = accumulator( 3.0 );\n* // returns -30.0\n*\n* p = accumulator( 5.0 );\n* // returns -75.0\n*\n* p = accumulator();\n* // returns -75.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "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 isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar isInfinite = require( '@stdlib/math-base-assert-is-infinite' );\nvar frexp = require( '@stdlib/math-base-special-frexp' ).assign;\nvar ldexp = require( '@stdlib/math-base-special-ldexp' );\nvar Float64Array = require( '@stdlib/array-float64' );\nvar format = require( '@stdlib/string-format' );\n\n\n// FUNCTIONS //\n\n/**\n* Computes an updated product.\n*\n* @private\n* @param {Array} workspace - workspace array\n* @param {Object} acc - accumulated fractional and exponent parts\n* @param {number} x - multiplicative factor\n* @returns {number} product\n*/\nfunction product( workspace, acc, x ) {\n\t// Split the incoming value into a normalized fraction and exponent:\n\tfrexp( x, workspace, 1, 0 );\n\n\t// Update the accumulated fraction:\n\tacc.frac *= workspace[ 0 ];\n\n\t// Update the accumulated exponent:\n\tacc.exp += workspace[ 1 ];\n\n\t// Ensure fraction remains normalized to avoid overflow/underflow...\n\tif ( acc.frac > -0.5 && acc.frac < 0.5 ) {\n\t\tfrexp( acc.frac, workspace, 1, 0 );\n\t\tacc.frac = workspace[ 0 ];\n\t\tacc.exp += workspace[ 1 ];\n\t}\n\treturn ldexp( acc.frac, acc.exp );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accumulator function which incrementally computes a moving product.\n*\n* ## Method\n*\n* To avoid overflow/underflow, we store the fractional and exponent parts of intermediate results separately. By keeping a normalized fraction, we prevent underflow/overflow of the fraction. Underflow of the exponent is impossible, as IEEE 754 floating-point exponents are integer values. Overflow of the exponent is possible, but highly unlikely. In the worst case, an intermediate exponent is greater than the minimum safe integer, and adding the exponent of an incoming value does not change the intermediate result. While incorrect, such behavior does not lead to exponent overflow.\n*\n* While intermediate results are largely immune to overflow and not subject to underflow, this does not mean that returned results will never be zero or infinite. In fact, zero (underflow) and infinite (overflow) results may be transient (i.e., infinity followed by a finite number).\n*\n* ## References\n*\n* - Ueberhuber, Christoph W. 1997. _Numerical Computation 1: Methods, Software, and Analysis_. Springer-Verlag Berlin Heidelberg. doi:[10.1007/978-3-642-59118-1](https://doi.org/10.1007/978-3-642-59118-1).\n*\n* @param {PositiveInteger} W - window size\n* @throws {TypeError} must provide a positive integer\n* @returns {Function} accumulator function\n*\n* @example\n* var accumulator = incrmprod( 3 );\n*\n* var p = accumulator();\n* // returns null\n*\n* p = accumulator( 2.0 );\n* // returns 2.0\n*\n* p = accumulator( -5.0 );\n* // returns -10.0\n*\n* p = accumulator( 3.0 );\n* // returns -30.0\n*\n* p = accumulator( 5.0 );\n* // returns -75.0\n*\n* p = accumulator();\n* // returns -75.0\n*/\nfunction incrmprod( W ) {\n\tvar parts;\n\tvar prod;\n\tvar buf;\n\tvar acc;\n\tvar N;\n\tvar i;\n\tif ( !isPositiveInteger( W ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a positive integer. Value: `%s`.', W ) );\n\t}\n\tbuf = new Float64Array( W );\n\ti = -1;\n\tN = 0;\n\n\t// Initialize a workspace for `frexp`:\n\tparts = [ 0.0, 0 ];\n\n\t// Initial product is 1.0, which may be split into its fractional and exponent parts (0.5 x 2.0**1 = 1.0):\n\tprod = 1.0;\n\tacc = {};\n\tacc.frac = 0.5;\n\tacc.exp = 1.0;\n\n\treturn accumulator;\n\n\t/**\n\t* If provided a value, the accumulator function returns an updated product. If not provided a value, the accumulator function returns the current product.\n\t*\n\t* @private\n\t* @param {number} [x] - input value\n\t* @returns {(number|null)} product or null\n\t*/\n\tfunction accumulator( x ) {\n\t\tvar k;\n\t\tvar v;\n\t\tif ( arguments.length === 0 ) {\n\t\t\tif ( N === 0 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn prod;\n\t\t}\n\t\t// Update the index for managing the circular buffer:\n\t\ti = (i+1) % W;\n\n\t\t// Case: incoming value is NaN, the accumulated value is automatically NaN...\n\t\tif ( isnan( x ) ) {\n\t\t\tN = W; // explicitly set to avoid `N < W` branch\n\t\t\tprod = NaN;\n\t\t}\n\t\t// Case: initial window...\n\t\telse if ( N < W ) {\n\t\t\tN += 1;\n\t\t\tprod = product( parts, acc, x );\n\t\t}\n\t\t// Case: outgoing value is a \"special\" value, and, thus, we need to compute the accumulated value...\n\t\telse if (\n\t\t\tbuf[ i ] === 0.0 ||\n\t\t\tisnan( buf[ i ] ) ||\n\t\t\tisInfinite( buf[ i ] )\n\t\t) {\n\t\t\tN = 1;\n\t\t\tacc.frac = 0.5;\n\t\t\tacc.exp = 1.0;\n\t\t\tproduct( parts, acc, x );\n\t\t\tfor ( k = 0; k < W; k++ ) {\n\t\t\t\tif ( k !== i ) {\n\t\t\t\t\tv = buf[ k ];\n\t\t\t\t\tif ( isnan( v ) ) {\n\t\t\t\t\t\tN = W; // explicitly set to avoid `N < W` branch\n\t\t\t\t\t\tprod = NaN;\n\t\t\t\t\t\tbreak; // product is automatically NaN, so no need to continue\n\t\t\t\t\t}\n\t\t\t\t\tN += 1;\n\t\t\t\t\tprod = product( parts, acc, v );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Case: neither the current accumulated value nor the incoming value are NaN, so we need to update the accumulated value...\n\t\telse if ( isnan( prod ) === false ) {\n\t\t\tv = x / buf[ i ];\n\t\t\tprod = product( parts, acc, v );\n\t\t}\n\t\t// Case: the current accumulated value is NaN, so nothing to do until the buffer no longer contains NaN values...\n\t\tbuf[ i ] = x;\n\n\t\treturn prod;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = incrmprod;\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* Compute a moving product incrementally.\n*\n* @module @stdlib/stats-incr-mprod\n*\n* @example\n* var incrmprod = require( '@stdlib/stats-incr-mprod' );\n*\n* var accumulator = incrmprod( 3 );\n*\n* var p = accumulator();\n* // returns null\n*\n* p = accumulator( 2.0 );\n* // returns 2.0\n*\n* p = accumulator( -5.0 );\n* // returns -10.0\n*\n* p = accumulator( 3.0 );\n* // returns -30.0\n*\n* p = accumulator( 5.0 );\n* // returns -75.0\n*\n* p = accumulator();\n* // returns -75.0\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,oCAAqC,EAAE,YACpEC,EAAQ,QAAS,iCAAkC,EACnDC,EAAa,QAAS,sCAAuC,EAC7DC,EAAQ,QAAS,iCAAkC,EAAE,OACrDC,EAAQ,QAAS,iCAAkC,EACnDC,EAAe,QAAS,uBAAwB,EAChDC,EAAS,QAAS,uBAAwB,EAc9C,SAASC,EAASC,EAAWC,EAAKC,EAAI,CAErC,OAAAP,EAAOO,EAAGF,EAAW,EAAG,CAAE,EAG1BC,EAAI,MAAQD,EAAW,CAAE,EAGzBC,EAAI,KAAOD,EAAW,CAAE,EAGnBC,EAAI,KAAO,KAAQA,EAAI,KAAO,KAClCN,EAAOM,EAAI,KAAMD,EAAW,EAAG,CAAE,EACjCC,EAAI,KAAOD,EAAW,CAAE,EACxBC,EAAI,KAAOD,EAAW,CAAE,GAElBJ,EAAOK,EAAI,KAAMA,EAAI,GAAI,CACjC,CA2CA,SAASE,EAAWC,EAAI,CACvB,IAAIC,EACAC,EACAC,EACAN,EACAO,EACAC,EACJ,GAAK,CAACjB,EAAmBY,CAAE,EAC1B,MAAM,IAAI,UAAWN,EAAQ,kEAAmEM,CAAE,CAAE,EAErG,OAAAG,EAAM,IAAIV,EAAcO,CAAE,EAC1BK,EAAI,GACJD,EAAI,EAGJH,EAAQ,CAAE,EAAK,CAAE,EAGjBC,EAAO,EACPL,EAAM,CAAC,EACPA,EAAI,KAAO,GACXA,EAAI,IAAM,EAEHS,EASP,SAASA,EAAaR,EAAI,CACzB,IAAIS,EACAC,EACJ,GAAK,UAAU,SAAW,EACzB,OAAKJ,IAAM,EACH,KAEDF,EAMR,GAHAG,GAAKA,EAAE,GAAKL,EAGPX,EAAOS,CAAE,EACbM,EAAIJ,EACJE,EAAO,YAGEE,EAAIJ,EACbI,GAAK,EACLF,EAAOP,EAASM,EAAOJ,EAAKC,CAAE,UAI9BK,EAAKE,CAAE,IAAM,GACbhB,EAAOc,EAAKE,CAAE,CAAE,GAChBf,EAAYa,EAAKE,CAAE,CAAE,GAMrB,IAJAD,EAAI,EACJP,EAAI,KAAO,GACXA,EAAI,IAAM,EACVF,EAASM,EAAOJ,EAAKC,CAAE,EACjBS,EAAI,EAAGA,EAAIP,EAAGO,IACnB,GAAKA,IAAMF,EAAI,CAEd,GADAG,EAAIL,EAAKI,CAAE,EACNlB,EAAOmB,CAAE,EAAI,CACjBJ,EAAIJ,EACJE,EAAO,IACP,KACD,CACAE,GAAK,EACLF,EAAOP,EAASM,EAAOJ,EAAKW,CAAE,CAC/B,OAIQnB,EAAOa,CAAK,IAAM,KAC3BM,EAAIV,EAAIK,EAAKE,CAAE,EACfH,EAAOP,EAASM,EAAOJ,EAAKW,CAAE,GAG/B,OAAAL,EAAKE,CAAE,EAAIP,EAEJI,CACR,CACD,CAKAf,EAAO,QAAUY,IC/IjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", "names": ["require_main", "__commonJSMin", "exports", "module", "isPositiveInteger", "isnan", "isInfinite", "frexp", "ldexp", "Float64Array", "format", "product", "workspace", "acc", "x", "incrmprod", "W", "parts", "prod", "buf", "N", "i", "accumulator", "k", "v", "main"] } diff --git a/lib/main.js b/lib/main.js index 5d2a40f..3af935d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -126,7 +126,7 @@ function incrmprod( W ) { return accumulator; /** - * If provided a value, the accumulator function returns an updated prodct. If not provided a value, the accumulator function returns the current prodct. + * If provided a value, the accumulator function returns an updated product. If not provided a value, the accumulator function returns the current product. * * @private * @param {number} [x] - input value