From 5cddbd24670afb6a1e557f3128ccc270cfe8046d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 28 Nov 2023 23:26:03 +0000 Subject: [PATCH 001/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8b22726..a3bc99d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.1.0", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e0977d04d423edd5876d509d0fa49f871460d799 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 28 Nov 2023 23:29:09 +0000 Subject: [PATCH 002/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 57 +- benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 45 files changed, 6214 insertions(+), 4884 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 0e65ae7..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -197,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 22c20ed..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ccd0b21..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index a7e56cf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e944d1c..88319d4 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..aab652f --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index a3bc99d..cf9f0df 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.0", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.1.0", - "@stdlib/array-base-zeros5d": "^0.1.0", - "@stdlib/bench": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-special-abs": "^0.1.1", - "@stdlib/math-base-special-floor": "^0.1.1", - "@stdlib/math-base-special-identity": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^0.1.0", - "@stdlib/utils-nary-function": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..458577a --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 0892ab6c461a3ea7d0174ecdebca18b85ac50126 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 11:36:37 +0000 Subject: [PATCH 003/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8b22726..a3bc99d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.1.0", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e3cc735768267acc8050c5ade7ab77039b0bc38e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 08:46:22 +0000 Subject: [PATCH 004/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6368 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 88319d4..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( `@stdlib/array/base/ones5d` ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( `@stdlib/array/base/ones5d` ); - * var zeros5d = require( `@stdlib/array/base/zeros5d` ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( `@stdlib/array/base/ones5d` ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( `@stdlib/array/base/ones5d` ); -* var zeros5d = require( `@stdlib/array/base/zeros5d` ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index aab652f..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 458577a..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8c485576d383fd694233e527df400523353313ac Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 08:48:49 +0000 Subject: [PATCH 005/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 57 +- benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 46 files changed, 6214 insertions(+), 4885 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 9c7f368..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T04:47:30.125Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 0e65ae7..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -197,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 22c20ed..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index ccd0b21..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index a7e56cf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e944d1c..88319d4 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..aab652f --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index a3bc99d..cf9f0df 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.0", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.1.0", - "@stdlib/array-base-zeros5d": "^0.1.0", - "@stdlib/bench": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-special-abs": "^0.1.1", - "@stdlib/math-base-special-floor": "^0.1.1", - "@stdlib/math-base-special-identity": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^0.1.0", - "@stdlib/utils-nary-function": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..a789dd2 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From c2b32e2b79e1efaa95679d303671ef7f9316c803 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 20 Dec 2023 02:20:02 +0000 Subject: [PATCH 006/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f5085e3..33855db 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.1.0", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 33c38b741f3d393873b49e619a11a20f77366697 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 20 Dec 2023 02:21:25 +0000 Subject: [PATCH 007/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6368 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 88319d4..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( `@stdlib/array/base/ones5d` ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( `@stdlib/array/base/ones5d` ); - * var zeros5d = require( `@stdlib/array/base/zeros5d` ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( `@stdlib/array/base/ones5d` ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( `@stdlib/array/base/ones5d` ); -* var zeros5d = require( `@stdlib/array/base/zeros5d` ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index aab652f..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index a789dd2..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 23523a725f05bc5b208dfd4bdc200b2c099507ed Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 20 Dec 2023 02:23:31 +0000 Subject: [PATCH 008/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 57 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 46 files changed, 6214 insertions(+), 4890 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 30656c4..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c92f5c4..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index cc1cda9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -197,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index a7e56cf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e944d1c..88319d4 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..aab652f --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 33855db..897a129 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.1.0", - "@stdlib/array-base-zeros5d": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-special-abs": "^0.1.1", - "@stdlib/math-base-special-floor": "^0.1.1", - "@stdlib/math-base-special-identity": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^0.1.0", - "@stdlib/utils-nary-function": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..7154d45 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 46f955fc7b154e916e99ab9f7b0fff82449f1b00 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 20 Dec 2023 02:23:56 +0000 Subject: [PATCH 009/108] Update README.md for ESM bundle v0.1.0 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 302c2ab..ac61d3d 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ limitations under the License. ## Usage ```javascript -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.1.0-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.1.0-esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +160,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.1.0-esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From 0ebe9db4c859b3d96fef7ae431ec9c8df0e7ad65 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 20 Dec 2023 02:23:57 +0000 Subject: [PATCH 010/108] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac61d3d..d4dc6fc 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-map5d/tags). For example, + ```javascript import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.1.0-esm/index.mjs'; ``` @@ -54,7 +59,7 @@ import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.1.0 You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.1.0-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +165,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.1.0-esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From f7407ab025df9ada9e95737de09c602f2249aa7a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 06:53:26 +0000 Subject: [PATCH 011/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f5085e3..33855db 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.1.0", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 9a41e0c5ba1ece0842a2ed7d45449d2ecf0b4d9a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 13:39:32 +0000 Subject: [PATCH 012/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6368 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 88319d4..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( `@stdlib/array/base/ones5d` ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( `@stdlib/array/base/ones5d` ); - * var zeros5d = require( `@stdlib/array/base/zeros5d` ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( `@stdlib/array/base/ones5d` ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( `@stdlib/array/base/ones5d` ); -* var zeros5d = require( `@stdlib/array/base/zeros5d` ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index aab652f..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 7154d45..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 66f0f3bf09901374853e200db1ae68b00957bdd3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 13:40:00 +0000 Subject: [PATCH 013/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 57 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 6214 insertions(+), 4891 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index e94561e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T04:13:51.375Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 30656c4..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c92f5c4..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 84e3388..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -197,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index a7e56cf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e944d1c..88319d4 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..01f9963 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 33855db..897a129 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.1.0", - "@stdlib/array-base-zeros5d": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-special-abs": "^0.1.1", - "@stdlib/math-base-special-floor": "^0.1.1", - "@stdlib/math-base-special-identity": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^0.1.0", - "@stdlib/utils-nary-function": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..828dfe5 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 74c573e63b70228e1a72249e9f6b03671da93886 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:11:56 +0000 Subject: [PATCH 014/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f5085e3..33855db 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.1.0", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b1711e5769d41ae8bc91527384c61000af2b5efe Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:30:17 +0000 Subject: [PATCH 015/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6368 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 88319d4..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( `@stdlib/array/base/ones5d` ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( `@stdlib/array/base/ones5d` ); - * var zeros5d = require( `@stdlib/array/base/zeros5d` ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( `@stdlib/array/base/ones5d` ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( `@stdlib/array/base/ones5d` ); -* var zeros5d = require( `@stdlib/array/base/zeros5d` ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 01f9963..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 828dfe5..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2bd8d730271ac7f8679f2d529f7f6440478d7c5a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:30:50 +0000 Subject: [PATCH 016/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 57 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 46 files changed, 6214 insertions(+), 4890 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 30656c4..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c92f5c4..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 84e3388..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -197,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index a7e56cf..0000000 --- a/branches.md +++ /dev/null @@ -1,53 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers. -- **deno**: [Deno][deno-url] branch for use in Deno. -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments. - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..01f9963 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 33855db..897a129 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.1.0", - "@stdlib/array-base-zeros5d": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-special-abs": "^0.1.1", - "@stdlib/math-base-special-floor": "^0.1.1", - "@stdlib/math-base-special-identity": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^0.1.0", - "@stdlib/utils-nary-function": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f60fff6 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From cddfd0d39b2152a0fb02048a63f1d0a3e5e9e3e1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 07:23:04 +0000 Subject: [PATCH 017/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f5085e3..33855db 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.1.0", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 107589eb958b6392b3db644735bfd3ded53410a3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 12:55:08 +0000 Subject: [PATCH 018/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6368 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 01f9963..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index f60fff6..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8aeeca30e6e147e8cd50bb8f6f480438ba4f90d8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 12:55:31 +0000 Subject: [PATCH 019/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 6214 insertions(+), 4896 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 129918e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T05:02:58.527Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 30656c4..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c92f5c4..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 84e3388..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..01f9963 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 33855db..897a129 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.1.0", - "@stdlib/array-base-zeros5d": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-special-abs": "^0.1.1", - "@stdlib/math-base-special-floor": "^0.1.1", - "@stdlib/math-base-special-identity": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^0.1.0", - "@stdlib/utils-nary-function": "^0.1.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ce688ac --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From e17f6cff527507b176e5055ca0bb2b8bed976ac9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 14:07:34 +0000 Subject: [PATCH 020/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 460cef1..894dc91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.3.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.1.0", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1276bea6f79fc5b40ae0e3a51eda4f536b9cb90a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 21:05:18 +0000 Subject: [PATCH 021/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6368 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 01f9963..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ce688ac..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 01738f726a8a72b6fd0c93403f64c092384777e6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 21:06:22 +0000 Subject: [PATCH 022/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 46 files changed, 6214 insertions(+), 4899 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 3d53f27..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..01f9963 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 894dc91..20368a3 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.0", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.1.0", - "@stdlib/array-base-zeros5d": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-special-abs": "^0.1.1", - "@stdlib/math-base-special-floor": "^0.1.1", - "@stdlib/math-base-special-identity": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^0.1.0", - "@stdlib/utils-nary-function": "^0.2.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..48c5cff --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 63ca0319c9924269e70fb444edb9d15a7680d519 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 22:10:33 +0000 Subject: [PATCH 023/108] Update README.md for ESM bundle v0.2.0 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2830adc..7d16000 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ limitations under the License. ## Usage ```javascript -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.0-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.0-esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +160,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.0-esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From 89e28f148b67baf834113f11584d35eff5d7e185 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 22:10:34 +0000 Subject: [PATCH 024/108] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7d16000..118f8d0 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-map5d/tags). For example, + ```javascript import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.0-esm/index.mjs'; ``` @@ -54,7 +59,7 @@ import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.0 You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.0-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +165,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.0-esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From 9955211a08578cd53e006278fc147b447c2f14a7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 00:17:24 +0000 Subject: [PATCH 025/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9a656ae..fbfb510 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.0", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From cf7d4d4952d5cdacb9a5c9219f946bdbea10afe4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 05:44:15 +0000 Subject: [PATCH 026/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6368 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 01f9963..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 48c5cff..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2d4c0197a7124bdc8b2a74d4bd001ef4087304e2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 05:45:43 +0000 Subject: [PATCH 027/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 46 files changed, 4879 insertions(+), 4893 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index fbfb510..708e4aa 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.0", - "@stdlib/array-base-zeros5d": "^0.2.0", - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/math-base-special-abs": "^0.2.0", - "@stdlib/math-base-special-floor": "^0.2.1", - "@stdlib/math-base-special-identity": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.0", - "@stdlib/ndarray-base-numel": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.0", - "@stdlib/random-base-uniform": "^0.2.0", - "@stdlib/utils-nary-function": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From b436be50a395c2cf3117a1006a7921e7e5ecf8ff Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 07:25:37 +0000 Subject: [PATCH 028/108] Update README.md for ESM bundle v0.2.1 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 52e630f..22d5f01 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ limitations under the License. ## Usage ```javascript -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.1-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.1-esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +160,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.1-esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From 8895aff3a7bfee68881a59c622353f19394f0c6d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 07:25:38 +0000 Subject: [PATCH 029/108] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 22d5f01..e5b24e1 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-map5d/tags). For example, + ```javascript import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.1-esm/index.mjs'; ``` @@ -54,7 +59,7 @@ import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.1 You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.1-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +165,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.1-esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From b8ba5c41803bf6a773af34bf4ff62463bd4ab707 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 06:45:41 +0000 Subject: [PATCH 030/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8d093d6..f14a366 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.1", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 45d5c9e27e0d73fc76ea2a1bcd247ac35b1660b9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 12:07:29 +0000 Subject: [PATCH 031/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a2a0e140172758466f355e9786b4bca1ed4454f2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 12:07:59 +0000 Subject: [PATCH 032/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 4895 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 274ff44..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T04:49:52.008Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index f14a366..708e4aa 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.1", - "@stdlib/array-base-zeros5d": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/math-base-special-abs": "^0.2.1", - "@stdlib/math-base-special-floor": "^0.2.1", - "@stdlib/math-base-special-identity": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/ndarray-base-numel": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From eaa883df0738259c71410cd52a19107491177c67 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 06:02:27 +0000 Subject: [PATCH 033/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b138439..c2640a4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.1", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c7ddb73cf0209b9bf0704dd9a8086b29e4097e3c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 11:11:44 +0000 Subject: [PATCH 034/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From afccdeea6e3428cb0d8144f8d46e40f1a3617f4a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 11:11:56 +0000 Subject: [PATCH 035/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 4898 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 4acf132..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T04:05:16.189Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index c2640a4..708e4aa 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.1", - "@stdlib/array-base-zeros5d": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/math-base-special-abs": "^0.2.1", - "@stdlib/math-base-special-floor": "^0.2.2", - "@stdlib/math-base-special-identity": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/ndarray-base-numel": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From daf1a4dea3ce627298d5d97ff96bc77da20d437b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 02:25:06 +0000 Subject: [PATCH 036/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b138439..c2640a4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.1", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From da8a1ef71a03b7e87c96e08cfc15dd3e09640882 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 07:53:46 +0000 Subject: [PATCH 037/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 27e508746111a326638b3361366e1a6dc7df1799 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 07:54:09 +0000 Subject: [PATCH 038/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 134 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 46 files changed, 4879 insertions(+), 4899 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.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 - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index c2640a4..708e4aa 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.1", - "@stdlib/array-base-zeros5d": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/math-base-special-abs": "^0.2.1", - "@stdlib/math-base-special-floor": "^0.2.2", - "@stdlib/math-base-special-identity": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/ndarray-base-numel": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 004259a2339a3ecdae2a6fc70ea20cff1846e428 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:19:30 +0000 Subject: [PATCH 039/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1d25d4d..d0a28f9 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.1", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From aa3b959cbda1e9e0a29a51a49bfbb1f13b55d593 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:35:06 +0000 Subject: [PATCH 040/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 77a9ab4584e5cd435580b2e5eaf769184a8e74c6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:35:21 +0000 Subject: [PATCH 041/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 46 files changed, 4879 insertions(+), 5007 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index d0a28f9..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.1", - "@stdlib/array-base-zeros5d": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 28edf61993638fab60e4ea6248f791deeb42f571 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:43:06 +0000 Subject: [PATCH 042/108] Update README.md for ESM bundle v0.2.2 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4548305..8b4e686 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ limitations under the License. ## Usage ```javascript -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.2-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.2-esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +160,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.2-esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From 0a0f488409341575affc07de2bae90c467d8acc3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:43:07 +0000 Subject: [PATCH 043/108] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8b4e686..a247711 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-map5d/tags). For example, + ```javascript import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.2-esm/index.mjs'; ``` @@ -54,7 +59,7 @@ import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.2 You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.2-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +165,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.2-esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From 8c1cceabe692953b2a29b7037b30eee56956c381 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 06:52:42 +0000 Subject: [PATCH 044/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e321d41..2f393eb 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 7e5a89fc02a706fd6b59dfea219e5b793f3bf5ea Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 11:32:52 +0000 Subject: [PATCH 045/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e006f1d0f80f4bdad92250162137f31f24d78b4c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 11:33:08 +0000 Subject: [PATCH 046/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 78 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 4986 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index 1733c55..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T04:56:17.037Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 2f393eb..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 4af4e137f0a1c68c139c5b61026f59f2b020eafc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 22:03:36 +0000 Subject: [PATCH 047/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e321d41..2f393eb 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From a5349f9020f6ec7958e3d1fb6be92c8af8d40196 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 4 Aug 2024 01:18:13 +0000 Subject: [PATCH 048/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From aec167623d28f1e7dd2ea700772b3613a635ea98 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 4 Aug 2024 01:18:33 +0000 Subject: [PATCH 049/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 5010 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index 6f916f3..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-03T20:24:16.397Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 2f393eb..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 20ee52b1d241fe1d7f800c75f7efe702a0b6ce2b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 07:12:05 +0000 Subject: [PATCH 050/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a13755c..b261c16 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f3d0e1f1e361216e6adbee153ff466b77bd0088b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 11:26:39 +0000 Subject: [PATCH 051/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2a5810ef6bbc854f585ea12d0b3eba2f479a5571 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 11:26:53 +0000 Subject: [PATCH 052/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 5010 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index 8be1d49..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T05:16:15.459Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index b261c16..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From a30554743c9f5bd07dfbffb35f5e3d9711f42e2c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 07:27:09 +0000 Subject: [PATCH 053/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a13755c..b261c16 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 613c5f64b260ead6fdba8cf79a69417a94834430 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 12:05:44 +0000 Subject: [PATCH 054/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From cd5c280ce8d6861daa735e6bf962896123a82cb4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 12:05:59 +0000 Subject: [PATCH 055/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 5010 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index ecbdf92..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T05:27:59.954Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index b261c16..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From c462512ab243bacf587ec3bd7b577aa8dc56ddfd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 07:19:36 +0000 Subject: [PATCH 056/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a13755c..b261c16 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From dc1077807410f41bb439d0d5594c362e38cec8e4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 11:18:31 +0000 Subject: [PATCH 057/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 48d4a8c04d19aeb1d0862365ec95ec1d162124c8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 11:18:49 +0000 Subject: [PATCH 058/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 5010 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index fc7933c..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T05:31:54.633Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..4a02312 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,g,j,v,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;iHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index b261c16..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c18fbba --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 1feb950a7c4a4488318c9c48fe9e4739de3a5765 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 07:35:24 +0000 Subject: [PATCH 059/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1c27ac8..c85d972 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 0f28027feb5eee0cad4a33e267d8210065806676 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 11:29:06 +0000 Subject: [PATCH 060/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 4a02312..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,g,j,v,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;iHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c18fbba..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 600ce7e1e582a7473d3f08a1b4b0a4c73e89c4d3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 11:29:18 +0000 Subject: [PATCH 061/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5115 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index d2a3223..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T05:40:26.261Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index c85d972..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 38825ebd29e96202e7da09933e2108c297b6f228 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 02:25:15 +0000 Subject: [PATCH 062/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1c27ac8..c85d972 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From db04de4397d1a09b38c7322a2b415f8ccd84c7a5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 03:06:11 +0000 Subject: [PATCH 063/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 81ce44aa7e519c3ba4946fd0b3b5e20ff2fe801c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 03:06:27 +0000 Subject: [PATCH 064/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5115 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0779e8a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index 6977073..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-30T02:12:04.965Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0573cfb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index c85d972..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 3bede12a9ab9da2f42e4a8188943b8de3e862865 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 6 Jan 2025 01:49:12 +0000 Subject: [PATCH 065/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1c27ac8..c85d972 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From feb5d84ef34e544a484ba9c209e67d350a1d2e36 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 6 Jan 2025 01:54:36 +0000 Subject: [PATCH 066/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0573cfb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d9e19729f41a011ac077b1be450296108082c887 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 6 Jan 2025 01:54:58 +0000 Subject: [PATCH 067/108] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 102 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5115 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0779e8a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index 5287387..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-01-06T01:47:27.714Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 567d3ae..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 4905bc9..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index c803356..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/math-base-special-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..cc61628 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index c85d972..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-identity": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 5632f8db55e3e3e0a296991689af2e2401d007a0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Apr 2025 01:07:05 +0000 Subject: [PATCH 068/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dfe4ff0..1aeb304 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c960007d783687dd6a958b056672b4b172ad6093 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Apr 2025 01:28:39 +0000 Subject: [PATCH 069/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index cc61628..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f5d662f3b568bc3af5d627131b4dc3ef06b48a17 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 14 Apr 2025 01:28:56 +0000 Subject: [PATCH 070/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 136 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5152 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index 607cd00..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-04-14T00:59:13.617Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 465903e..db0ec35 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..cc61628 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 1aeb304..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/number-float64-base-identity": "github:stdlib-js/number-float64-base-identity#main", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From df41a01264d4f4fc4ce09b5ef30c7270cedceefa Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 25 Jun 2025 12:31:30 +0000 Subject: [PATCH 071/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dfe4ff0..1aeb304 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1be379710f0f7e24a0e62200be91f926a884c994 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 25 Jun 2025 12:31:46 +0000 Subject: [PATCH 072/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index db0ec35..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* -- **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index cc61628..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a420a331f8c7fb1dcf469c6df4abf8ff75f160bb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 25 Jun 2025 12:32:21 +0000 Subject: [PATCH 073/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 138 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 5153 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..cc61628 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 1aeb304..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/number-float64-base-identity": "github:stdlib-js/number-float64-base-identity#main", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 57e858b0edc82e03a1da26e8b240c37e1a2cd696 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 28 Jul 2025 00:36:29 +0000 Subject: [PATCH 074/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dfe4ff0..1aeb304 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 6136a970e342c894ba2d1665c733ea564ff01deb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 28 Jul 2025 00:37:06 +0000 Subject: [PATCH 075/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index cc61628..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 851b1af2e22034e84b4caf016eeb824a091ff2cb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 28 Jul 2025 00:37:23 +0000 Subject: [PATCH 076/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 138 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5154 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index 1a2ee21..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-07-28T00:35:58.608Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..cc61628 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 1aeb304..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/number-float64-base-identity": "github:stdlib-js/number-float64-base-identity#main", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From e285b9264c2a65f5d09fd4414880e27e63eac0f4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Aug 2025 01:29:38 +0000 Subject: [PATCH 077/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dfe4ff0..1aeb304 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 12fab9a42308d2fcc86af22ff2e8300bae723b2a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Aug 2025 01:47:21 +0000 Subject: [PATCH 078/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index cc61628..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d8ea5aed1ca0c2aec10a080461123db17e5cc486 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Aug 2025 01:47:43 +0000 Subject: [PATCH 079/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 138 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5154 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index f1f7ec2..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-08-11T01:21:42.888Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..cc61628 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 1aeb304..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/number-float64-base-identity": "github:stdlib-js/number-float64-base-identity#main", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 8b74e6435c1230ec0ecae7b23a471ce338545a3b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 15 Aug 2025 19:25:02 +0000 Subject: [PATCH 080/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dfe4ff0..1aeb304 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -90,4 +91,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 38331c28de9560be20c7f59ca62f43d341c4793f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 15 Aug 2025 19:30:09 +0000 Subject: [PATCH 081/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index cc61628..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From cfd5d6e8a34fc012323e628d1fc5efc1b7708258 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 15 Aug 2025 19:30:31 +0000 Subject: [PATCH 082/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 140 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 67 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 5155 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..cc61628 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 1aeb304..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/number-float64-base-identity": "github:stdlib-js/number-float64-base-identity#main", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -86,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 9402ad9f14acc8f5800f6136d8965b48f3eef83a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 30 Jan 2026 22:12:50 +0000 Subject: [PATCH 083/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4647ad1..25c0cd3 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 84bc45f82593d4392d6383cc61769de1f0667a43 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 30 Jan 2026 22:20:01 +0000 Subject: [PATCH 084/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index cc61628..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 151529887583c5ad689bd7be518cacb5cf7aeb2a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 30 Jan 2026 22:20:25 +0000 Subject: [PATCH 085/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 108 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 140 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 66 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 5259 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..69e6dff --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 25c0cd3..c7b5e92 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/number-float64-base-identity": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.1", - "@stdlib/utils-nary-function": "^0.2.3", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -90,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ccff7fc --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 819cd45c08ab34eedb52ff33241db816883ca7df Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 06:48:57 +0000 Subject: [PATCH 086/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 55d4cf4..2303e9f 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.2", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From fb9f35f0f6b100814c3daa9c9e5dfa2776674a90 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 07:54:24 +0000 Subject: [PATCH 087/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 69e6dff..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ccff7fc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c8e5c90e263770eba20fb0a3192a244fc02f4573 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 07:54:38 +0000 Subject: [PATCH 088/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 140 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 66 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4879 insertions(+), 5252 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b5f76c3 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 2303e9f..0591843 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.2", - "@stdlib/array-base-zeros5d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.3", - "@stdlib/math-base-special-abs": "^0.2.3", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/ndarray-base-numel": "^0.2.3", - "@stdlib/number-float64-base-identity": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^0.2.2", - "@stdlib/utils-nary-function": "^0.2.4", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -90,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..41b61c8 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From c9189f905fd4f992b8dc10cb041abafd9f60bd60 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 08:18:32 +0000 Subject: [PATCH 089/108] Update README.md for ESM bundle v0.2.3 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8587590..d9f2da5 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ limitations under the License. ## Usage ```javascript -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.3-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.3-esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +160,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.3-esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From fd203f9891409073d10cc315493a559ba85b6aeb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 08:18:32 +0000 Subject: [PATCH 090/108] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d9f2da5..6e5a7c0 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-map5d/tags). For example, + ```javascript import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.3-esm/index.mjs'; ``` @@ -54,7 +59,7 @@ import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.3 You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.3-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; ``` #### map5d( x, shape, fcn\[, thisArg] ) @@ -160,7 +165,7 @@ var discreteUniform = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-bas import filled5dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled5d-by@esm/index.mjs'; import naryFunction from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-nary-function@esm/index.mjs'; import abs from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-special-abs@esm/index.mjs'; -import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@v0.2.3-esm/index.mjs'; +import map5d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-map5d@esm/index.mjs'; var shape = [ 1, 1, 3, 3, 3 ]; From d11a570646cf53ee8cbbd2e568ee4ab148e94443 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Mar 2026 01:07:08 +0000 Subject: [PATCH 091/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c23a5f..244c05f 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.3", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From de9552753de5369015b7191e2794ffe04a6db993 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Mar 2026 01:11:02 +0000 Subject: [PATCH 092/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b5f76c3..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 41b61c8..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ca04179c7833733a1cb2d9ec5bdad27b73f5c7be Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Mar 2026 01:11:27 +0000 Subject: [PATCH 093/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 140 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 66 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5253 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index be6361e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-03-09T01:04:58.643Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b5f76c3 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 244c05f..0591843 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.3", - "@stdlib/array-base-zeros5d": "^0.2.3", - "@stdlib/math-base-assert-is-nan": "^0.2.3", - "@stdlib/math-base-special-abs": "^0.2.3", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/ndarray-base-numel": "^0.2.3", - "@stdlib/number-float64-base-identity": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/utils-nary-function": "^0.2.4", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -90,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..41b61c8 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 3253a19fee74b2d922d966037d2883fca5d861bc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 16 Mar 2026 03:25:29 +0000 Subject: [PATCH 094/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c23a5f..244c05f 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.3", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e59cd04898214326266b7c41c1f34db61c99a48e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 16 Mar 2026 05:11:07 +0000 Subject: [PATCH 095/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b5f76c3..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 41b61c8..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 9d14f53a1745c9479cd250c37b93c0c22d2f954d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 16 Mar 2026 05:11:29 +0000 Subject: [PATCH 096/108] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 140 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 66 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5253 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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/.keepalive b/.github/.keepalive deleted file mode 100644 index 1288ddd..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-03-16T02:27:17.737Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b5f76c3 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 244c05f..0591843 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.3", - "@stdlib/array-base-zeros5d": "^0.2.3", - "@stdlib/math-base-assert-is-nan": "^0.2.3", - "@stdlib/math-base-special-abs": "^0.2.3", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/ndarray-base-numel": "^0.2.3", - "@stdlib/number-float64-base-identity": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/utils-nary-function": "^0.2.4", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -90,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..41b61c8 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 4b9d304e44cf209b75782fea2849015e9a0b1d0a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 29 Mar 2026 03:39:42 +0000 Subject: [PATCH 097/108] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c23a5f..244c05f 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, "devDependencies": { "@stdlib/array-base-filled5d-by": "^0.2.3", @@ -89,4 +90,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b0c0d7aa4198d6b25ff866bf77d2148b1d328306 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 29 Mar 2026 03:49:29 +0000 Subject: [PATCH 098/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b5f76c3..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 41b61c8..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c90bbe9806cd37ceca9b7ecc0151379cfabf0c3b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 29 Mar 2026 03:49:48 +0000 Subject: [PATCH 099/108] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 140 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 123 - benchmark/benchmark.js | 117 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 66 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4879 insertions(+), 5264 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index b8adf4e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-03-29T03:31:27.906Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index f3a4ee0..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,123 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:assign:size='+numel( sh ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index a6cd05e..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b5f76c3 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index 244c05f..0591843 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.3", - "@stdlib/array-base-zeros5d": "^0.2.3", - "@stdlib/math-base-assert-is-nan": "^0.2.3", - "@stdlib/math-base-special-abs": "^0.2.3", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/ndarray-base-numel": "^0.2.3", - "@stdlib/number-float64-base-identity": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/utils-nary-function": "^0.2.4", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -90,4 +30,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..41b61c8 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From e14430573ce265f981ad6263a463fa7b3786816a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 14 Apr 2026 10:18:17 +0000 Subject: [PATCH 100/108] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c7a9ebe..c00bcd0 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@stdlib/number-float64-base-identity": "^0.1.1", "@stdlib/random-base-discrete-uniform": "^0.2.2", "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/utils-nary-function": "^0.2.4", "tape": "git+https://github.com/kgryte/tape.git#fix/globby", "istanbul": "^0.4.1", From 0842c7fddde5adaa8758f82ab1088b5ea045f266 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 14 Apr 2026 10:31:13 +0000 Subject: [PATCH 101/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b5f76c3..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 41b61c8..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e4fb4f083c9e1ddca9def5e108d0834475180197 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 14 Apr 2026 10:31:30 +0000 Subject: [PATCH 102/108] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 175 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 124 - benchmark/benchmark.js | 118 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 64 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 47 files changed, 4878 insertions(+), 5299 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 3a63fcd..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,124 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( format( '%s::equidimensional:assign:size=%d', pkg, numel( sh ) ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 4636d04..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( format( '%s::equidimensional:size=%d', pkg, numel( sh ) ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b5f76c3 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index c00bcd0..0591843 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.3", - "@stdlib/array-base-zeros5d": "^0.2.3", - "@stdlib/math-base-assert-is-nan": "^0.2.3", - "@stdlib/math-base-special-abs": "^0.2.3", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/ndarray-base-numel": "^0.2.3", - "@stdlib/number-float64-base-identity": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/utils-nary-function": "^0.2.4", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..41b61c8 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From 2b29ae2525fd762670098f62fe2c2489e4124e79 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 May 2026 03:23:37 +0000 Subject: [PATCH 103/108] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c7a9ebe..c00bcd0 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@stdlib/number-float64-base-identity": "^0.1.1", "@stdlib/random-base-discrete-uniform": "^0.2.2", "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/utils-nary-function": "^0.2.4", "tape": "git+https://github.com/kgryte/tape.git#fix/globby", "istanbul": "^0.4.1", From 11d4fed5f7822b3004db524300521dbb894c7b30 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 May 2026 03:27:43 +0000 Subject: [PATCH 104/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b5f76c3..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 41b61c8..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8c3c5fba47c656d1aed930b2b4c15ffd91e5e012 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 May 2026 03:27:59 +0000 Subject: [PATCH 105/108] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 204 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 175 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 124 - benchmark/benchmark.js | 118 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 64 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4878 insertions(+), 5305 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index b1fbd28..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-05-06T03:20:33.098Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 3a63fcd..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,124 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( format( '%s::equidimensional:assign:size=%d', pkg, numel( sh ) ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 4636d04..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( format( '%s::equidimensional:size=%d', pkg, numel( sh ) ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 8a0bafd..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(f,r){return function(){return r||f((r={exports:{}}).exports,r),r.exports}};var k=b(function(G,j){ -function B(f,r,n,R){var O,s,S,e,x,o,a,v,i,u,t,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b5f76c3 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index c00bcd0..0591843 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.3", - "@stdlib/array-base-zeros5d": "^0.2.3", - "@stdlib/math-base-assert-is-nan": "^0.2.3", - "@stdlib/math-base-special-abs": "^0.2.3", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/ndarray-base-numel": "^0.2.3", - "@stdlib/number-float64-base-identity": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/utils-nary-function": "^0.2.4", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..41b61c8 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); From d0795e49e2b6e2680c7d50996f0e9570c2c7a87b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 14 Jun 2026 03:34:59 +0000 Subject: [PATCH 106/108] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d224e35..e216608 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@stdlib/number-float64-base-identity": "^0.1.1", "@stdlib/random-base-discrete-uniform": "^0.2.2", "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/utils-nary-function": "^0.2.4", "tape": "git+https://github.com/kgryte/tape.git#fix/globby", "istanbul": "^0.4.1", From 301678cc5925a9a205f38e8092445a4a8ac892dc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 14 Jun 2026 03:54:10 +0000 Subject: [PATCH 107/108] Remove files --- index.d.ts | 186 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5033 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 618919d..0000000 --- a/index.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Array5D } from '@stdlib/types/array'; -import { Shape5D } from '@stdlib/types/ndarray'; - -/** -* Array element indices. -*/ -type Indices = [ number, number, number, number, number ]; - -/** -* Callback invoked for each array element. -* -* @returns result -*/ -type Nullary = ( this: V ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @returns result -*/ -type Unary = ( this: V, value: T ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @returns result -*/ -type Binary = ( this: V, value: T, indices: Indices ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Ternary = ( this: V, value: T, indices: Indices, array: Array5D ) => U; - -/** -* Callback invoked for each array element. -* -* @param value - array element -* @param indices - current array element indices -* @param array - input array -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Interface describing the main export. -*/ -interface Routine { - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. - * - * @param x - input nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = map5d( x, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - */ - ( x: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; - - /** - * Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. - * - * @param x - input nested array - * @param y - output nested array - * @param shape - array shape - * @param fcn - function to apply - * @param thisArg - function execution context - * - * @example - * var ones5d = require( '@stdlib/array-base-ones5d' ); - * var zeros5d = require( '@stdlib/array-base-zeros5d' ); - * - * function scale( x ) { - * return x * 10.0; - * } - * - * var shape = [ 1, 1, 1, 2, 2 ]; - * - * var x = ones5d( shape ); - * var y = zeros5d( shape ); - * - * var out = map5d.assign( x, y, shape, scale ); - * // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] - * - * var bool = ( out === y ); - * // returns true - */ - assign( x: Array5D, y: Array5D, shape: Shape5D, fcn: Callback, thisArg?: ThisParameterType> ): Array5D; -} - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* ## Notes -* -* - The applied function is provided the following arguments: -* -* - **value**: array element. -* - **indices**: current array element indices. -* - **array**: input nested array. -* -* @param x - input nested array -* @param shape - array shape -* @param fcn - function to apply -* @param thisArg - function execution context -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -declare var map5d: Routine; - - -// EXPORTS // - -export = map5d; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b5f76c3..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 41b61c8..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4e2baa76b08304da19553e2a85eaa7d4809338c3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 14 Jun 2026 03:54:34 +0000 Subject: [PATCH 108/108] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 204 - .npmignore | 229 - .npmrc | 44 - CHANGELOG.md | 175 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 59 +- SECURITY.md | 5 - benchmark/benchmark.assign.js | 124 - benchmark/benchmark.js | 118 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 227 - examples/index.js | 33 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 109 - lib/index.js | 75 - lib/main.js | 101 - package.json | 64 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 321 -- test/test.js | 38 - test/test.main.js | 310 -- 48 files changed, 4878 insertions(+), 5318 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.js delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -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/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# 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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 3a8afb5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-06-14T03:30:09.007Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5c984e7..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 13d8998..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 4ffe095..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '32 8 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - 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 - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # 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\": \"^$PKG_VERSION\"/g" package.json - else - 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: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -199,7 +196,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.js b/benchmark/benchmark.assign.js deleted file mode 100644 index 3a63fcd..0000000 --- a/benchmark/benchmark.assign.js +++ /dev/null @@ -1,124 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ).assign; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x; - var y; - - x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - y = zeros5d( shape ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, y, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( format( '%s::equidimensional:assign:size=%d', pkg, numel( sh ) ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 4636d04..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var map5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var x = filled5dBy( shape, uniform( -100.0, 100.0 ) ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = map5d( x, shape, identity ); - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shape[ 0 ]; - i3 = i % shape[ 1 ]; - i2 = i % shape[ 2 ]; - i1 = i % shape[ 3 ]; - i0 = i % shape[ 4 ]; - if ( isnan( out[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var sh; - var N; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( format( '%s::equidimensional:size=%d', pkg, numel( sh ) ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index f2529e0..0000000 --- a/branches.md +++ /dev/null @@ -1,56 +0,0 @@ - - -# Branches - -This repository has the following branches: - -- **main**: default branch generated from the [stdlib project][stdlib-url], where all development takes place. -- **production**: [production build][production-url] of the package (e.g., reformatted error messages to reduce bundle sizes and thus the number of bytes transmitted over a network). -- **esm**: [ES Module][esm-url] branch for use via a `script` tag without the need for installation and bundlers (see [README][esm-readme]). -- **deno**: [Deno][deno-url] branch for use in Deno (see [README][deno-readme]). -- **umd**: [UMD][umd-url] branch for use in Observable, or in dual browser/Node.js environments (see [README][umd-readme]). - -The following diagram illustrates the relationships among the above branches: - -```mermaid -graph TD; -A[stdlib]-->|generate standalone package|B; -B[main] -->|productionize| C[production]; -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/array/base/map5d" -%% click B href "https://github.com/stdlib-js/array-base-map5d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-map5d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-map5d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-map5d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-map5d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/map5d -[production-url]: https://github.com/stdlib-js/array-base-map5d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-map5d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-map5d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-map5d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-map5d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-map5d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-map5d/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8aec770..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import map5d from '../docs/types/index'; -export = map5d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 71801d5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var b=function(n,r){return function(){try{return r||n((r={exports:{}}).exports,r),r.exports}catch(o){throw (r=0, o)}};};var k=b(function(G,j){ -function B(n,r,o,R){var O,s,S,e,x,t,a,v,i,u,f,y,q,c,g,l,p,d,m;for(O=r[4],s=r[3],S=r[2],e=r[1],x=r[0],m=[],u=0;u} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = map5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var map5d = require( '@stdlib/array-base-map5d' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "iIAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA4CA,SAASC,EAAOC,EAAGC,EAAOC,EAAKC,EAAU,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdqB,EAAI,CAAC,EACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,CAAG,EACXQ,EAAK,CAAC,EACAT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAK,CAAC,EACAR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAK,CAAC,EACAP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAK,CAAC,EACAN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAG,KAAMb,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGT,CAAE,CAAE,EAEnEiB,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAI,EAAG,KAAMF,CAAG,CACb,CACAG,EAAE,KAAMD,CAAG,CACZ,CACA,OAAOC,CACR,CAKAxB,EAAO,QAAUC,ICpGjB,IAAAwB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAOC,EAAGC,EAAGC,EAAOC,EAAKC,EAAU,CAC3C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACTG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOR,EAER,IAAMa,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKrB,EAAGc,CAAG,EACXQ,EAAKrB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,CAAG,EACZO,EAAKE,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,CAAG,EACZM,EAAKE,EAAIR,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,CAAG,EACZK,EAAKE,EAAIP,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,CAAG,EAAIP,EAAI,KAAMC,EAASW,EAAIL,CAAG,EAAG,CAAEI,EAAID,EAAID,EAAID,EAAID,CAAG,EAAGV,CAAE,EAMvE,OAAOC,CACR,CAKAH,EAAO,QAAUC,IC9CjB,IAAIwB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "map5d", "x", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "y", "require_assign", "__commonJSMin", "exports", "module", "map5d", "x", "y", "shape", "fcn", "thisArg", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index f9a0679..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a new five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: Array - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var y = {{alias}}( x, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - - -{{alias}}.assign( x, y, shape, fcn[, thisArg] ) - Applies a function to elements in a five-dimensional nested input array and - assigns results to elements in a five-dimensional nested output array. - - Parameters - ---------- - x: ArrayLikeObject - Input nested array. - - y: ArrayLikeObject - Output nested array. - - shape: Array - Array shape. - - fcn: Function - Function to apply. - - thisArg: any (optional) - Function execution context. - - Returns - ------- - out: ArrayLikeObject - Output nested array. - - Examples - -------- - > var x = [ [ [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ] ] ]; - > var y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shape = [ 1, 1, 1, 2, 2 ]; - > var out = {{alias}}.assign( x, y, shape, {{alias:@stdlib/math/base/special/abs}} ) - [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ] - > var b = ( out === y ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 69996ee..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,227 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import map5d = require( './index' ); - -/** -* Unary function. -* -* @param value - input value -* @returns result -*/ -function fcn( value: number ): number { - return value; -} - - -// TESTS // - -// The function returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the function is provided a first argument which is not a nested array... -{ - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d( 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d( ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, 'abc', fcn ); // $ExpectError - map5d( x, 3.14, fcn ); // $ExpectError - map5d( x, true, fcn ); // $ExpectError - map5d( x, false, fcn ); // $ExpectError - map5d( x, null, fcn ); // $ExpectError - map5d( x, [ '1' ], fcn ); // $ExpectError - map5d( x, {}, fcn ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn ); // $ExpectError - - map5d( x, 'abc', fcn, {} ); // $ExpectError - map5d( x, 3.14, fcn, {} ); // $ExpectError - map5d( x, true, fcn, {} ); // $ExpectError - map5d( x, false, fcn, {} ); // $ExpectError - map5d( x, null, fcn, {} ); // $ExpectError - map5d( x, [ '1' ], fcn, {} ); // $ExpectError - map5d( x, {}, fcn, {} ); // $ExpectError - map5d( x, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d( x, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d(); // $ExpectError - map5d( x ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d( x, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} - -// Attached to the main export is an `assign` method which returns a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectType Array5D - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectType Array5D -} - -// The compiler throws an error if the `assign` method is provided a first argument which is not a nested array... -{ - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( 'abc', y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( 3.14, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( true, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( false, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( null, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( [ '1' ], y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( {}, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( ( x: number ): number => x, y, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a second argument which is not a nested array... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn ); // $ExpectError - - map5d.assign( x, 'abc', [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, 3.14, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, true, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, false, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, null, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, [ '1' ], [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, {}, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError - map5d.assign( x, ( x: number ): number => x, [ 1, 1, 1, 2, 2 ], fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a third argument which is not an array of numbers... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, 'abc', fcn ); // $ExpectError - map5d.assign( x, y, 3.14, fcn ); // $ExpectError - map5d.assign( x, y, true, fcn ); // $ExpectError - map5d.assign( x, y, false, fcn ); // $ExpectError - map5d.assign( x, y, null, fcn ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn ); // $ExpectError - map5d.assign( x, y, {}, fcn ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn ); // $ExpectError - - map5d.assign( x, y, 'abc', fcn, {} ); // $ExpectError - map5d.assign( x, y, 3.14, fcn, {} ); // $ExpectError - map5d.assign( x, y, true, fcn, {} ); // $ExpectError - map5d.assign( x, y, false, fcn, {} ); // $ExpectError - map5d.assign( x, y, null, fcn, {} ); // $ExpectError - map5d.assign( x, y, [ '1' ], fcn, {} ); // $ExpectError - map5d.assign( x, y, {}, fcn, {} ); // $ExpectError - map5d.assign( x, y, ( x: number ): number => x, fcn, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided a fourth argument which is not a valid callback... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc' ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14 ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {} ); // $ExpectError - - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 'abc', {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], 3.14, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], true, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], false, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], null, {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], [ '1' ], {} ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], {}, {} ); // $ExpectError -} - -// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... -{ - const x = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const y = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - - map5d.assign(); // $ExpectError - map5d.assign( x, y ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ] ); // $ExpectError - map5d.assign( x, y, [ 1, 1, 1, 2, 2 ], fcn, {}, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4cc7852..0000000 --- a/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filled5dBy = require( '@stdlib/array-base-filled5d-by' ); -var naryFunction = require( '@stdlib/utils-nary-function' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var map5d = require( './../lib' ); - -var shape = [ 1, 1, 3, 3, 3 ]; - -var x = filled5dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = map5d( x, shape, naryFunction( abs, 1 ) ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index e105ec9..618919d 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array5D } from '@stdlib/types/array'; import { Shape5D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b5f76c3 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.3-esm/index.mjs";function o(r,o,s,n){var e,f,t,u,a,i,l,p,d,h,c,m,v,g,j,b,x,y,k;for(e=o[4],f=o[3],t=o[2],u=o[1],a=o[0],k=[],h=0;h} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*/\nfunction map5d( x, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\tvar y;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\ty = [];\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = [];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = [];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = [];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = [];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t\ty1.push( y0 );\n\t\t\t\t}\n\t\t\t\ty2.push( y1 );\n\t\t\t}\n\t\t\ty3.push( y2 );\n\t\t}\n\t\ty.push( y3 );\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject} x - input nested array\n* @param {ArrayLikeObject} y - output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @returns {Array} output array\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\nfunction map5d( x, y, shape, fcn, thisArg ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar x0;\n\tvar y0;\n\tvar x1;\n\tvar y1;\n\tvar x2;\n\tvar y2;\n\tvar x3;\n\tvar y3;\n\n\tS0 = shape[ 4 ];\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn y;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tx3 = x[ i4 ];\n\t\ty3 = y[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tx2 = x3[ i3 ];\n\t\t\ty2 = y3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tx1 = x2[ i2 ];\n\t\t\t\ty1 = y2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tx0 = x1[ i1 ];\n\t\t\t\t\ty0 = y1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\ty0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default map5d;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.\n*\n* @module @stdlib/array-base-map5d\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = map5d( x, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* @example\n* import ones5d from '@stdlib/array-base-ones5d';\n* import zeros5d from '@stdlib/array-base-zeros5d';\n* import map5d from '@stdlib/array-base-map5d';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* var x = ones5d( shape );\n* var y = zeros5d( shape );\n*\n* var out = map5d.assign( x, y, shape, scale );\n* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ]\n*\n* var bool = ( out === y );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["map5d","x","shape","fcn","thisArg","S0","S1","S2","S3","S4","i0","i1","i2","i3","i4","x0","y0","x1","y1","x2","y2","x3","y3","y","push","call","setReadOnly","main","assign"],"mappings":";;wHA4CA,SAASA,EAAOC,EAAGC,EAAOC,EAAKC,GAC9B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAQJ,IANAlB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACZqB,EAAI,GACET,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAO,EAAKpB,EAAGa,GACRQ,EAAK,GACCT,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAM,EAAKE,EAAIR,GACTO,EAAK,GACCR,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAK,EAAKE,EAAIP,GACTM,EAAK,GACCP,EAAK,EAAGA,EAAKL,EAAIK,IAAO,CAG7B,IAFAI,EAAKE,EAAIN,GACTK,EAAK,GACCN,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAGQ,KAAMrB,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,IAE/DiB,EAAGM,KAAMR,EACT,CACDI,EAAGI,KAAMN,EACT,CACDI,EAAGE,KAAMJ,EACT,CACDG,EAAEC,KAAMF,EACR,CACD,OAAOC,CACR,CCxCA,SAASvB,EAAOC,EAAGsB,EAAGrB,EAAOC,EAAKC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAOJ,GALAjB,EAAKH,EAAO,GACZI,EAAKJ,EAAO,GACZK,EAAKL,EAAO,GACZM,EAAKN,EAAO,GACZO,EAAKP,EAAO,GACPG,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAAKC,GAAM,EACtD,OAAOc,EAER,IAAMT,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAO,EAAKpB,EAAGa,GACRQ,EAAKC,EAAGT,GACFD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAM,EAAKE,EAAIR,GACTO,EAAKE,EAAIT,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAK,EAAKE,EAAIP,GACTM,EAAKE,EAAIR,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IAGtB,IAFAI,EAAKE,EAAIN,GACTK,EAAKE,EAAIP,GACHD,EAAK,EAAGA,EAAKL,EAAIK,IACtBM,EAAIN,GAAOP,EAAIsB,KAAMrB,EAASW,EAAIL,GAAM,CAAEI,EAAID,EAAID,EAAID,EAAID,GAAMT,GAMrE,OAAOsB,CACR,CClCAG,EAAAC,EAAA,SAAAC"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 0f91b88..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a five-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject} x - input nested array -* @param {ArrayLikeObject} y - output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ -function map5d( x, y, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { - return y; - } - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = y[ i4 ]; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = y3[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = y2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = y1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - y0[ i0 ] = fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ); // eslint-disable-line max-len - } - } - } - } - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 16462b0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array. -* -* @module @stdlib/array-base-map5d -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* var zeros5d = require( '@stdlib/array-base-zeros5d' ); -* var map5d = require( '@stdlib/array-base-map5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = zeros5d( shape ); -* -* var out = map5d.assign( x, y, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -* -* var bool = ( out === y ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a59167a..0000000 --- a/lib/main.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a function to elements in a five-dimensional nested input array and assigns results to elements in a new five-dimensional nested output array. -* -* @param {ArrayLikeObject} x - input nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Function} fcn - function to apply -* @param {*} [thisArg] - function execution context -* @returns {Array} output array -* -* @example -* var ones5d = require( '@stdlib/array-base-ones5d' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* var x = ones5d( shape ); -* var y = map5d( x, shape, scale ); -* // returns [ [ [ [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ] ] ] ] -*/ -function map5d( x, shape, fcn, thisArg ) { - var S0; - var S1; - var S2; - var S3; - var S4; - var i0; - var i1; - var i2; - var i3; - var i4; - var x0; - var y0; - var x1; - var y1; - var x2; - var y2; - var x3; - var y3; - var y; - - S0 = shape[ 4 ]; - S1 = shape[ 3 ]; - S2 = shape[ 2 ]; - S3 = shape[ 1 ]; - S4 = shape[ 0 ]; - y = []; - for ( i4 = 0; i4 < S4; i4++ ) { - x3 = x[ i4 ]; - y3 = []; - for ( i3 = 0; i3 < S3; i3++ ) { - x2 = x3[ i3 ]; - y2 = []; - for ( i2 = 0; i2 < S2; i2++ ) { - x1 = x2[ i2 ]; - y1 = []; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x1[ i1 ]; - y0 = []; - for ( i0 = 0; i0 < S0; i0++ ) { - y0.push( fcn.call( thisArg, x0[ i0 ], [ i4, i3, i2, i1, i0 ], x ) ); // eslint-disable-line max-len - } - y1.push( y0 ); - } - y2.push( y1 ); - } - y3.push( y2 ); - } - y.push( y3 ); - } - return y; -} - - -// EXPORTS // - -module.exports = map5d; diff --git a/package.json b/package.json index e216608..0591843 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Apply a function to elements in a five-dimensional nested input array and assign results to elements in a new five-dimensional nested output array.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,43 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.5.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-base-filled5d-by": "^0.2.3", - "@stdlib/array-base-zeros5d": "^0.2.3", - "@stdlib/math-base-assert-is-nan": "^0.2.3", - "@stdlib/math-base-special-abs": "^0.2.3", - "@stdlib/math-base-special-floor": "^0.2.4", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/ndarray-base-numel": "^0.2.3", - "@stdlib/number-float64-base-identity": "^0.1.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/random-base-uniform": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/utils-nary-function": "^0.2.4", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..41b61c8 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index 4b12bf2..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var zeros5d = require( '@stdlib/array-base-zeros5d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ).assign; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - y = zeros5d( shape ); - out = map5d( x, y, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var shape; - var out; - var x; - var y; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = zeros5d( shape ); - - y = zeros5d( shape ); - out = map5d( x, y, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - var y; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - y = zeros5d( shape ); - out = map5d( x, y, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( out, y, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index d646d1b..0000000 --- a/test/test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( typeof map5d.assign, 'function', 'method is a function' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 207fcb8..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,310 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var map5d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof map5d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to a nested input array and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var out; - var x; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - out = map5d( x, shape, abs ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a first element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = []; - - out = map5d( x, [ 0, 1, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a second element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [] - ]; - - out = map5d( x, [ 1, 0, 1, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a third element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [] - ] - ]; - - out = map5d( x, [ 1, 1, 0, 2, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fourth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 0, 2 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function does not invoke a provided callback if provided a shape having a fifth element equal to zero', function test( t ) { - var expected; - var out; - var x; - - x = [ - [ - [ - [ - [ -1.0, -2.0 ], - [ -3.0, -4.0 ] - ] - ] - ] - ]; - - expected = [ - [ - [ - [ - [], - [] - ] - ] - ] - ]; - - out = map5d( x, [ 1, 1, 1, 2, 0 ], clbk ); - - t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); - -tape( 'the function supports providing a function execution context', function test( t ) { - var expected; - var indices; - var values; - var arrays; - var shape; - var out; - var ctx; - var x; - - values = []; - indices = []; - arrays = []; - - shape = [ 1, 1, 1, 2, 2 ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - - ctx = { - 'count': 0 - }; - out = map5d( x, shape, fcn, ctx ); - - expected = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - t.deepEqual( out, expected, 'returns expected value' ); - t.strictEqual( ctx.count, numel( shape ), 'returns expected value' ); - - expected = [ - 1.0, - 2.0, - 3.0, - 4.0 - ]; - t.deepEqual( values, expected, 'returns expected value' ); - - expected = [ - [ 0, 0, 0, 0, 0 ], - [ 0, 0, 0, 0, 1 ], - [ 0, 0, 0, 1, 0 ], - [ 0, 0, 0, 1, 1 ] - ]; - t.deepEqual( indices, expected, 'returns expected value' ); - - expected = [ - x, - x, - x, - x - ]; - t.deepEqual( arrays, expected, 'returns expected value' ); - - t.end(); - - function fcn( value, idx, array ) { - values.push( value ); - indices.push( idx ); - arrays.push( array ); - ctx.count += 1; - return value; - } -});