From 6b1c8ae5cdc425c6dd92071ff29430f0b6d73a8b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:27:49 +0000 Subject: [PATCH] Release v0.1.0 --- .editorconfig | 5 + .github/.keepalive | 1 - .github/workflows/productionize.yml | 32 +++---- .github/workflows/publish.yml | 139 ++++++++++++++++++++++++++-- .github/workflows/test.yml | 7 +- .github/workflows/test_bundles.yml | 6 +- .github/workflows/test_coverage.yml | 2 +- .github/workflows/test_install.yml | 2 +- .gitignore | 4 + CITATION.cff | 30 ++++++ CONTRIBUTORS | 19 +++- README.md | 17 +++- branches.md | 12 +-- dist/index.d.ts | 3 + dist/index.js | 7 ++ dist/index.js.map | 7 ++ docs/types/index.d.ts | 27 +++--- docs/types/test.ts | 8 +- package.json | 28 +++--- 19 files changed, 275 insertions(+), 81 deletions(-) delete mode 100644 .github/.keepalive create mode 100644 CITATION.cff create mode 100644 dist/index.d.ts create mode 100644 dist/index.js create mode 100644 dist/index.js.map 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 823b2c8..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-02-01T02:32:05.253Z diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml index f4eea88..91f2b93 100644 --- a/.github/workflows/productionize.yml +++ b/.github/workflows/productionize.yml @@ -34,6 +34,12 @@ on: type: boolean default: true + # Run workflow upon completion of `publish` workflow run: + workflow_run: + workflows: ["publish"] + types: [completed] + + # Concurrency group to prevent multiple concurrent executions: concurrency: group: productionize @@ -76,28 +82,14 @@ 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: | + PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json + sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" + node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" fi # Configure git: @@ -342,7 +334,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -513,7 +505,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -690,7 +682,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ad8ed19..474004b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,9 +21,23 @@ name: publish # Workflow triggers: on: - # Run workflow when a new tag is pushed to the repository: - push: - tags: v[0-9]+.[0-9]+.[0-9]+ + # Allow the workflow to be manually run: + workflow_dispatch: + # Workflow inputs: + inputs: + version: + description: 'Version Increment' + type: choice + default: 'none' + options: + - 'none' + - 'major' + - 'minor' + - 'patch' + - 'premajor' + - 'preminor' + - 'prepatch' + - 'prerelease' # Workflow jobs: jobs: @@ -32,7 +46,7 @@ jobs: publish: # Define display name: - name: 'Publish to npm' + name: 'Publish package to npm' # Define the type of virtual host machine on which to run the job: runs-on: ubuntu-latest @@ -40,6 +54,7 @@ jobs: # Define environment variables: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Define the sequence of job steps... steps: @@ -55,6 +70,91 @@ jobs: node-version: 16 timeout-minutes: 5 + # Configure git: + - name: 'Configure git' + run: | + git config --local user.email "noreply@stdlib.io" + git config --local user.name "stdlib-bot" + + # Increment package version (if requested): + - name: 'Increment package version (if requested)' + if: ${{ github.event.inputs.version != 'none' }} + run: | + # Save NPM_TOKEN to user's .npmrc: + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + + # Increment package version: + npm version ${{ github.event.inputs.version }} --no-git-tag-version + + # Define variable for new version: + NEW_VERSION=$(node -p "require('./package.json').version") + + # Replace branch in README.md link definitions for badges with the new version: + find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/branch([=:])[^ ]+/branch\1v${NEW_VERSION}/g" + + # Create a new commit and tag: + git add package.json README.md + git commit -m "Release v${NEW_VERSION}" + git tag -a "v${NEW_VERSION}" -m "Release v${NEW_VERSION}" + + # Push changes to GitHub: + SLUG=${{ github.repository }} + git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" --follow-tags + + # Remove CLI: + - name: 'Remove CLI' + if: ${{ github.ref == 'refs/heads/main' }} + run: | + # Exit if the package does not have a CLI: + if ! grep -q '"bin":' package.json; then + exit 0 + fi + rm -rf ./bin/cli + rm -f test/test.cli.js + rm -f etc/cli_opts.json + rm -f docs/usage.txt + + # For all dependencies, check in all *.js files if they are still used; if not, remove them: + jq -r '.dependencies | keys[]' ./package.json | while read -r dep; do + dep=$(echo "$dep" | xargs) + if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then + jq --indent 2 "del(.dependencies[\"$dep\"])" ./package.json > ./package.json.tmp + mv ./package.json.tmp ./package.json + fi + done + jq -r '.devDependencies | keys[]' ./package.json | while read -r dep; do + if [[ "$dep" != "@stdlib"* ]]; then + continue + fi + dep=$(echo "$dep" | xargs) + if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then + jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp + mv ./package.json.tmp ./package.json + fi + done + + # Remove CLI section: + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+?<\!\-\- \/.cli \-\->//" + + # Remove CLI from package.json: + jq -r 'del(.bin)' package.json > package.json.tmp + mv package.json.tmp package.json + + # Add entry for CLI package to See Also section of README.md: + cliPkgName=$(jq -r '.name' package.json)-cli + escapedPkg=$(echo "$cliPkgName" | sed -e 's/\//\\\//g') + escapedPkg=$(echo "$escapedPkg" | sed -e 's/\@/\\\@/g') + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
(?:\n\n\* \* \*\n\n## See Also\n\n)?/
\n\n## See Also\n\n- [\`$escapedPkg\`][$escapedPkg]<\/span>: <\/span>CLI package for use as a command-line utility.<\/span>\n/" + + # Add link definition for CLI package to README.md: + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
/
\n\n[$escapedPkg]: https:\/\/www.npmjs.com\/package\/$escapedPkg/" + + # Replace GitHub MathJax equations with SVGs: + - name: 'Replace GitHub MathJax equations with SVGs' + run: | + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/```math\n([\s\S]+?)\n```\n\n//g' + find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe 's/)/
/sg' + # Replace GitHub links to individual packages with npm links: - name: 'Replace all GitHub links to individual packages with npm links' run: | @@ -65,14 +165,39 @@ jobs: run: | find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`\n\nAlternatively,[^<]+<\/section>/\`\`\`\n\n<\/section>/" + # Remove unnecessary files: + - name: 'Remove unnecessary files' + run: | + rm -f docs/repl.txt + rm -f docs/types/test.ts + # Replace all stdlib GitHub dependencies with the respective npm packages: - name: 'Replace all stdlib GitHub dependencies with the respective npm packages' run: | - find package.json -type f -print0 | xargs -0 sed -Ei 's/"github:stdlib-js[^"]*"/"^0.0.x"/g' + for dep in $(jq -r '.dependencies | keys | .[]' package.json); do + if [[ "$dep" != "@stdlib"* ]]; then + continue + fi + # Trim leading and trailing whitespace: + dep=$(echo "$dep" | xargs) + version="^$(npm view $dep version)" + jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp + mv package.json.tmp package.json + done + for dep in $(jq -r '.devDependencies | keys | .[]' package.json); do + if [[ "$dep" != "@stdlib"* ]]; then + continue + fi + # Trim leading and trailing whitespace: + dep=$(echo "$dep" | xargs) + version="^$(npm view $dep version)" + jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp + mv package.json.tmp package.json + done # Publish package to npm: - name: 'Publish package to npm' - uses: JS-DevTools/npm-publish@v1 + uses: JS-DevTools/npm-publish@v2 with: token: ${{ secrets.NPM_TOKEN }} access: public @@ -84,7 +209,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 822a0b3..315e929 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,11 @@ on: # Run workflow on each push to the main branch: push: + # Run workflow upon completion of `publish` workflow run: + workflow_run: + workflows: ["publish"] + types: [completed] + # Workflow jobs: jobs: @@ -84,7 +89,7 @@ jobs: # Send status to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test_bundles.yml b/.github/workflows/test_bundles.yml index e9df6a0..172cb2d 100644 --- a/.github/workflows/test_bundles.yml +++ b/.github/workflows/test_bundles.yml @@ -88,7 +88,7 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -130,7 +130,7 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -172,7 +172,7 @@ jobs: # Send notification to Slack channel if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test_coverage.yml b/.github/workflows/test_coverage.yml index 6d8aa0b..a73c515 100644 --- a/.github/workflows/test_coverage.yml +++ b/.github/workflows/test_coverage.yml @@ -106,7 +106,7 @@ jobs: # Send Slack notification if job fails: - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index d09119e..dbc7c82 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -75,7 +75,7 @@ jobs: # Send Slack notification if job fails: - name: 'Send notification to Slack in case of failure' - uses: act10ns/slack@v1 + uses: act10ns/slack@v2 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} diff --git a/.gitignore b/.gitignore index 9641214..49b206b 100644 --- a/.gitignore +++ b/.gitignore @@ -182,3 +182,7 @@ jsconfig.json ################ *.sublime-workspace *.sublime-project + +# Other editor files # +###################### +.idea/ 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/CONTRIBUTORS b/CONTRIBUTORS index f97b6ef..93c4bde 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3,28 +3,37 @@ # Contributors listed in alphabetical order. Ali Salesi +Amit Jimiwal Athan Reines Brendan Graetz Bruno Fenzl Christopher Dambamuromo +Dan Rose Dominik Moritz +Dorrin Sotoudeh Frank Kovacs -James +Harshita Kalani +James Gelok Jithin KS Joey Reed +Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Joris Labie Justin Dennison -Marcus +Marcus Fantham Matt Cochrane Milan Raj Momtchil Momtchev +Naresh Jagadeesan +Nithin Katta <88046362+nithinkatta@users.noreply.github.com> Ognjen Jevremović Philipp Burckhardt -Pranav <85227306+Pranavchiku@users.noreply.github.com> +Pranav Goswami Ricky Reusser +Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com> Ryan Seal Seyyed Parsa Neshaei Shraddheya Shendre Stephannie Jiménez Gacha -dorrin-sot <59933477+dorrin-sot@users.noreply.github.com> -rei2hu +Yernar Yergaziyev +orimiles5 <97595296+orimiles5@users.noreply.github.com> +rei2hu diff --git a/README.md b/README.md index 6e0f700..beae638 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,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!

+
+ # atanhBy [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] @@ -292,8 +303,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [npm-image]: http://img.shields.io/npm/v/@stdlib/math-strided-special-atanh-by.svg [npm-url]: https://npmjs.org/package/@stdlib/math-strided-special-atanh-by -[test-image]: https://github.com/stdlib-js/math-strided-special-atanh-by/actions/workflows/test.yml/badge.svg?branch=main -[test-url]: https://github.com/stdlib-js/math-strided-special-atanh-by/actions/workflows/test.yml?query=branch:main +[test-image]: https://github.com/stdlib-js/math-strided-special-atanh-by/actions/workflows/test.yml/badge.svg?branch=v0.1.0 +[test-url]: https://github.com/stdlib-js/math-strided-special-atanh-by/actions/workflows/test.yml?query=branch:v0.1.0 [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-strided-special-atanh-by/main.svg [coverage-url]: https://codecov.io/github/stdlib-js/math-strided-special-atanh-by?branch=main @@ -306,7 +317,7 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. --> [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg -[chat-url]: https://gitter.im/stdlib-js/stdlib/ +[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im [stdlib]: https://github.com/stdlib-js/stdlib diff --git a/branches.md b/branches.md index e98c801..97f9833 100644 --- a/branches.md +++ b/branches.md @@ -38,12 +38,12 @@ C -->|bundle| D[esm]; C -->|bundle| E[deno]; C -->|bundle| F[umd]; -click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/strided/special/atanh-by" -click B href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/main" -click C href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/production" -click D href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/esm" -click E href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/deno" -click F href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/umd" +%% click A href "https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/strided/special/atanh-by" +%% click B href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/main" +%% click C href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/production" +%% click D href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/esm" +%% click E href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/deno" +%% click F href "https://github.com/stdlib-js/math-strided-special-atanh-by/tree/umd" ``` [stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/strided/special/atanh-by diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..45f771c --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +/// +import atanhBy from '../docs/types/index'; +export = atanhBy; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..31a44f4 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,7 @@ +"use strict";var s=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var q=s(function(g,y){ +var h=require('@stdlib/strided-base-map-by/dist'),B=require('@stdlib/math-base-special-atanh/dist');function m(a,r,e,t,n,u,i){return h(a,r,e,t,n,B,u,i)}y.exports=m +});var c=s(function(j,v){ +var x=require('@stdlib/strided-base-map-by/dist').ndarray,f=require('@stdlib/math-base-special-atanh/dist');function l(a,r,e,t,n,u,i,p,d){return x(a,r,e,t,n,u,i,f,p,d)}v.exports=l +});var O=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),o=q(),R=c();O(o,"ndarray",R);module.exports=o; +/** @license Apache-2.0 */ +//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..f096c54 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../lib/main.js", "../lib/ndarray.js", "../lib/index.js"], + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 mapBy = require( '@stdlib/strided-base-map-by' );\nvar atanh = require( '@stdlib/math-base-special-atanh' );\n\n\n// MAIN //\n\n/**\n* Computes the hyperbolic arctangent of each element retrieved from an input strided array `x` via a callback function and assigns each result to an element in an output strided array `y`.\n*\n* @param {NonNegativeInteger} N - number of indexed elements\n* @param {Collection} x - input array/collection\n* @param {integer} strideX - `x` stride length\n* @param {Collection} y - destination array/collection\n* @param {integer} strideY - `y` stride length\n* @param {Callback} clbk - callback\n* @param {*} [thisArg] - callback execution context\n* @returns {Collection} `y`\n*\n* @example\n* function accessor( v ) {\n* return v;\n* }\n*\n* var x = [ 0.0, -0.5, 1.0, -0.25, 0.75 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n*\n* atanhBy( x.length, x, 1, y, 1, accessor );\n*\n* console.log( y );\n* // => [ 0.0, ~-0.549, Infinity, ~-0.255, ~0.973 ]\n*/\nfunction atanhBy( N, x, strideX, y, strideY, clbk, thisArg ) {\n\treturn mapBy( N, x, strideX, y, strideY, atanh, clbk, thisArg );\n}\n\n\n// EXPORTS //\n\nmodule.exports = atanhBy;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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/* eslint-disable max-len */\n\n'use strict';\n\n// MODULES //\n\nvar mapBy = require( '@stdlib/strided-base-map-by' ).ndarray;\nvar atanh = require( '@stdlib/math-base-special-atanh' );\n\n\n// MAIN //\n\n/**\n* Computes the hyperbolic arctangent of each element retrieved from an input strided array `x` via a callback function and assigns each result to an element in an output strided array `y`.\n*\n* @param {NonNegativeInteger} N - number of indexed elements\n* @param {Collection} x - input array/collection\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Collection} y - destination array/collection\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @param {Callback} clbk - callback\n* @param {*} [thisArg] - callback execution context\n* @returns {Collection} `y`\n*\n* @example\n* function accessor( v ) {\n* return v;\n* }\n*\n* var x = [ 0.0, -0.5, 1.0, -0.25, 0.75 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n*\n* atanhBy( x.length, x, 1, 0, y, 1, 0, accessor );\n*\n* console.log( y );\n* // => [ 0.0, ~-0.549, Infinity, ~-0.255, ~0.973 ]\n*/\nfunction atanhBy( N, x, strideX, offsetX, y, strideY, offsetY, clbk, thisArg ) {\n\treturn mapBy( N, x, strideX, offsetX, y, strideY, offsetY, atanh, clbk, thisArg );\n}\n\n\n// EXPORTS //\n\nmodule.exports = atanhBy;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 the hyperbolic arctangent of each element retrieved from an input strided array `x` via a callback function and assign each result to an element in an output strided array `y`.\n*\n* @module @stdlib/math-strided-special-atanh-by\n*\n* @example\n* var atanhBy = require( '@stdlib/math-strided-special-atanh-by' );\n*\n* function accessor( v ) {\n* return v;\n* }\n*\n* var x = [ 0.0, -0.5, 1.0, -0.25, 0.75 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n*\n* atanhBy( x.length, x, 1, y, 1, accessor );\n*\n* console.log( y );\n* // => [ 0.0, ~-0.549, Infinity, ~-0.255, ~0.973 ]\n*\n* @example\n* var atanhBy = require( '@stdlib/math-strided-special-atanh-by' );\n*\n* function accessor( v ) {\n* return v;\n* }\n*\n* var x = [ 0.0, -0.5, 1.0, -0.25, 0.75 ];\n* var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ];\n*\n* atanhBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor );\n*\n* console.log( y );\n* // => [ 0.0, ~-0.549, Infinity, ~-0.255, ~0.973 ]\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAQ,QAAS,6BAA8B,EAC/CC,EAAQ,QAAS,iCAAkC,EA8BvD,SAASC,EAASC,EAAGC,EAAGC,EAASC,EAAGC,EAASC,EAAMC,EAAU,CAC5D,OAAOT,EAAOG,EAAGC,EAAGC,EAASC,EAAGC,EAASN,EAAOO,EAAMC,CAAQ,CAC/D,CAKAV,EAAO,QAAUG,IC5DjB,IAAAQ,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwBA,IAAIC,EAAQ,QAAS,6BAA8B,EAAE,QACjDC,EAAQ,QAAS,iCAAkC,EAgCvD,SAASC,EAASC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAASC,EAAMC,EAAU,CAC9E,OAAOX,EAAOG,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAASR,EAAOS,EAAMC,CAAQ,CACjF,CAKAZ,EAAO,QAAUG,ICNjB,IAAIU,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD", + "names": ["require_main", "__commonJSMin", "exports", "module", "mapBy", "atanh", "atanhBy", "N", "x", "strideX", "y", "strideY", "clbk", "thisArg", "require_ndarray", "__commonJSMin", "exports", "module", "mapBy", "atanh", "atanhBy", "N", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "clbk", "thisArg", "setReadOnly", "main", "ndarray"] +} diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts index eac398f..45df027 100644 --- a/docs/types/index.d.ts +++ b/docs/types/index.d.ts @@ -16,18 +16,18 @@ * limitations under the License. */ -// TypeScript Version: 2.0 +// TypeScript Version: 4.1 /// -import { Collection } from '@stdlib/types/object'; +import { Collection } from '@stdlib/types/array'; /** * Returns an accessed value. * * @returns accessed value */ -type Nullary = () => number | void; +type Nullary = ( this: V ) => number | void; /** * Returns an accessed value. @@ -35,7 +35,7 @@ type Nullary = () => number | void; * @param value - array element * @returns accessed value */ -type Unary = ( value: any ) => number | void; +type Unary = ( this: V, value: T ) => number | void; /** * Returns an accessed value. @@ -44,7 +44,7 @@ type Unary = ( value: any ) => number | void; * @param idx - iteration index * @returns accessed value */ -type Binary = ( value: any, idx: number ) => number | void; +type Binary = ( this: V, value: T, idx: number ) => number | void; /** * Returns an accessed value. @@ -54,7 +54,7 @@ type Binary = ( value: any, idx: number ) => number | void; * @param xi - strided index (offsetX + idx*strideX) * @returns accessed value */ -type Ternary = ( value: any, idx: number, xi: number ) => number | void; +type Ternary = ( this: V, value: T, idx: number, xi: number ) => number | void; /** * Returns an accessed value. @@ -65,8 +65,7 @@ type Ternary = ( value: any, idx: number, xi: number ) => number | void; * @param yi - strided index (offsetY + idx*strideY) * @returns accessed value */ -type Quaternary = ( value: any, idx: number, xi: number, yi: number ) => number | void; // tslint-disable-line max-line-length - +type Quaternary = ( this: V, value: T, idx: number, xi: number, yi: number ) => number | void; /** * Returns an accessed value. * @@ -77,8 +76,7 @@ type Quaternary = ( value: any, idx: number, xi: number, yi: number ) => number * @param x - input array * @returns accessed value */ -type Quinary = ( value: any, idx: number, xi: number, yi: number, x: Collection ) => number | void; // tslint-disable-line max-line-length - +type Quinary = ( this: V, value: T, idx: number, xi: number, yi: number, x: Collection ) => number | void; /** * Returns an accessed value. * @@ -90,8 +88,7 @@ type Quinary = ( value: any, idx: number, xi: number, yi: number, x: Collection * @param y - output array * @returns accessed value */ -type Senary = ( value: any, idx: number, xi: number, yi: number, x: Collection, y: Collection ) => number | void; // tslint-disable-line max-line-length - +type Senary = ( this: V, value: T, idx: number, xi: number, yi: number, x: Collection, y: Collection ) => number | void; /** * Returns an accessed value. * @@ -103,7 +100,7 @@ type Senary = ( value: any, idx: number, xi: number, yi: number, x: Collection, * @param y - output array * @returns accessed value */ -type Callback = Nullary | Unary | Binary | Ternary | Quaternary | Quinary | Senary; // tslint-disable-line max-line-length +type Callback = Nullary | Unary | Binary | Ternary | Quaternary | Quinary | Senary; /** * Interface describing `atanhBy`. @@ -132,7 +129,7 @@ interface Routine { * atanhBy( x.length, x, 1, y, 1, accessor ); * // y => [ 0.0, ~-0.549, Infinity, ~-0.255, ~0.973 ] */ - ( N: number, x: Collection, strideX: number, y: Collection, strideY: number, clbk: Callback, thisArg?: any ): Collection; // tslint:disable-line:max-line-length + ( N: number, x: Collection, strideX: number, y: Collection, strideY: number, clbk: Callback, thisArg?: ThisParameterType> ): Collection; /** * Computes the hyperbolic arctangent of each element retrieved from an input strided array `x` via a callback function and assigns each result to an element in an output strided array `y` using alternative indexing semantics. @@ -159,7 +156,7 @@ interface Routine { * atanhBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor ); * // y => [ 0.0, ~-0.549, Infinity, ~-0.255, ~0.973 ] */ - ndarray( N: number, x: Collection, strideX: number, offsetX: number, y: Collection, strideY: number, offsetY: number, clbk: Callback, thisArg?: any ): Collection; // tslint:disable-line:max-line-length + ndarray( N: number, x: Collection, strideX: number, offsetX: number, y: Collection, strideY: number, offsetY: number, clbk: Callback, thisArg?: ThisParameterType> ): Collection; } /** diff --git a/docs/types/test.ts b/docs/types/test.ts index 478228c..9d5a25f 100644 --- a/docs/types/test.ts +++ b/docs/types/test.ts @@ -35,8 +35,8 @@ function accessor(): number { const x = new Float64Array( 10 ); const y = new Float64Array( 10 ); - atanhBy( x.length, x, 1, y, 1, accessor ); // $ExpectType Collection - atanhBy( x.length, x, 1, y, 1, accessor, {} ); // $ExpectType Collection + atanhBy( x.length, x, 1, y, 1, accessor ); // $ExpectType Collection + atanhBy( x.length, x, 1, y, 1, accessor, {} ); // $ExpectType Collection } // The compiler throws an error if the function is provided a first argument which is not a number... @@ -143,8 +143,8 @@ function accessor(): number { const x = new Float64Array( 10 ); const y = new Float64Array( 10 ); - atanhBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor ); // $ExpectType Collection - atanhBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor, {} ); // $ExpectType Collection + atanhBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor ); // $ExpectType Collection + atanhBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor, {} ); // $ExpectType Collection } // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... diff --git a/package.json b/package.json index 1f80758..c353ba0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stdlib/math-strided-special-atanh-by", - "version": "0.0.7", + "version": "0.1.0", "description": "Compute the hyperbolic arctangent of each element retrieved from an input strided array via a callback function.", "license": "Apache-2.0", "author": { @@ -37,19 +37,19 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/math-base-special-atanh": "^0.0.x", - "@stdlib/strided-base-map-by": "^0.0.x", - "@stdlib/types": "^0.0.x", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x" + "@stdlib/math-base-special-atanh": "^0.1.0", + "@stdlib/strided-base-map-by": "^0.1.0", + "@stdlib/types": "^0.1.0", + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0" }, "devDependencies": { - "@stdlib/array-filled": "^0.0.x", - "@stdlib/array-filled-by": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-uniform": "^0.0.x", + "@stdlib/array-filled": "^0.0.6", + "@stdlib/array-filled-by": "^0.0.2", + "@stdlib/array-float64": "^0.1.0", + "@stdlib/bench": "^0.1.0", + "@stdlib/math-base-assert-is-nan": "^0.1.0", + "@stdlib/math-base-special-pow": "^0.1.0", + "@stdlib/random-base-uniform": "^0.0.6", "tape": "git+https://github.com/kgryte/tape.git#fix/globby", "istanbul": "^0.4.1", "tap-min": "git+https://github.com/Planeshifter/tap-min.git" @@ -97,7 +97,7 @@ ], "__stdlib__": {}, "funding": { - "type": "patreon", - "url": "https://www.patreon.com/athan" + "type": "opencollective", + "url": "https://opencollective.com/stdlib" } }