From f945e370effa52b4174810a920b3d9e53925cbf1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 27 Aug 2023 08:08:12 +0000 Subject: [PATCH 01/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0b7c92d..2de2092 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.0.1", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 2c6e5eec50eeecb23ee9734df1ee8993725798b7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 27 Aug 2023 08:10:06 +0000 Subject: [PATCH 02/78] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 30 - docs/types/index.d.ts | 66 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 121 - 43 files changed, 12399 insertions(+), 3852 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +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 `tslint.json` files: -[tslint.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 30c1286..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/binary2d) 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 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +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' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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 a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +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' - uses: styfle/cancel-workflow-action@0.11.0 - 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 674ed2c..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +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: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - 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/binary2d) 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 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +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 the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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 6bdf0a4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +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: '39 15 * * 4' - - # 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' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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' - uses: actions/upload-artifact@v3 - 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' - uses: distributhor/workflow-webhook@v3 - 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 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +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' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - 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' - uses: actions/checkout@v3 - - # 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' - uses: actions/setup-node@v3 - 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' - uses: act10ns/slack@v2 - 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' - uses: actions/checkout@v3 - - # 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' - uses: actions/setup-node@v3 - 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 1d9aeb7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,30 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two-dimensional nested input arrays - and assigns results to elements in a two-dimensional nested output array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 6115b84..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param value - input value -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index f147668..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b840925..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 2de2092..3ecef70 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.0", "description": "Apply a binary callback to elements in two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.0.14", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.0.1", - "@stdlib/array-base-zeros2d": "github:stdlib-js/array-base-zeros2d#main", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/math-base-ops-add": "^0.0.1", - "@stdlib/math-base-special-floor": "^0.0.8", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/ndarray-base-numel": "^0.0.8", - "@stdlib/random-base-discrete-uniform": "^0.0.6", - "@stdlib/random-base-uniform": "^0.0.6", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..c8a5777 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..accecdd --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index a8fc080..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From f2746229be41cbaf3a44ad953b0cafd24c9ac142 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Sep 2023 04:23:44 +0000 Subject: [PATCH 03/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3969cbb..852dfd1 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.0.1", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b56551e1d60c8b05dbf3175b93f11bff61eac18a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Sep 2023 04:24:13 +0000 Subject: [PATCH 04/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index c8a5777..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index accecdd..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6373a6bd9c561393932352726902c7bdfee5ade1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Sep 2023 04:25:17 +0000 Subject: [PATCH 05/78] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 66 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 121 - 43 files changed, 12399 insertions(+), 3853 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +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 `tslint.json` files: -[tslint.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 30c1286..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/binary2d) 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 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +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' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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 a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +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' - uses: styfle/cancel-workflow-action@0.11.0 - 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 674ed2c..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +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: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - 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/binary2d) 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 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +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 the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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 6bdf0a4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +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: '39 15 * * 4' - - # 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' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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' - uses: actions/upload-artifact@v3 - 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' - uses: distributhor/workflow-webhook@v3 - 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 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +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' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - 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' - uses: actions/checkout@v3 - - # 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' - uses: actions/setup-node@v3 - 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' - uses: act10ns/slack@v2 - 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' - uses: actions/checkout@v3 - - # 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' - uses: actions/setup-node@v3 - 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 5482435..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param value - input value -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 466a055..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 852dfd1..7e833a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.0.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.0.14", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.0.1", - "@stdlib/array-base-zeros2d": "github:stdlib-js/array-base-zeros2d#main", - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/math-base-ops-add": "^0.0.1", - "@stdlib/math-base-special-floor": "^0.0.8", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/ndarray-base-numel": "^0.0.8", - "@stdlib/random-base-discrete-uniform": "^0.0.6", - "@stdlib/random-base-uniform": "^0.0.6", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..ad85058 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..05f8c3e --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 1086bdc5762945dcd427c2ea3b908bfc4c3745bd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Sep 2023 04:25:37 +0000 Subject: [PATCH 06/78] Update README.md for UMD bundle v0.0.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0c0f33f..5d711b9 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.0.0-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -62,7 +62,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From d0772fc910d3e80b829102718c2d32606d5ce4cc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Sep 2023 04:25:38 +0000 Subject: [PATCH 07/78] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d711b9..da8e881 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +``` +The previous example will load the latest bundled code from the umd 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-binary2d/tags). For example, + ```javascript binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.0.0-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From 43db9863b9851eb9bda001206b1eb75c18ed6d66 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 15:51:45 +0000 Subject: [PATCH 08/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4ccbf37..68dc62b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.0" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8950c7bb3b3b7f072ec5c5678c10ba415201e093 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:20:42 +0000 Subject: [PATCH 09/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index ad85058..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 05f8c3e..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 80556d6a7314f3835bacc0aed1be56c6f705a9b8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:23:07 +0000 Subject: [PATCH 10/78] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 66 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 121 - 43 files changed, 12399 insertions(+), 3853 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +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 `tslint.json` files: -[tslint.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 30c1286..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/binary2d) 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 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +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' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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 a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +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' - uses: styfle/cancel-workflow-action@0.11.0 - 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 674ed2c..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +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: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - 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/binary2d) 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 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +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 the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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 6bdf0a4..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +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: '39 15 * * 4' - - # 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' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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' - uses: actions/upload-artifact@v3 - 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' - uses: distributhor/workflow-webhook@v3 - 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 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +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' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - 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' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - 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' - uses: actions/checkout@v3 - - # 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' - uses: actions/setup-node@v3 - 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' - uses: act10ns/slack@v2 - 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' - uses: actions/checkout@v3 - - # 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' - uses: actions/setup-node@v3 - 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 5482435..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param value - input value -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 466a055..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 68dc62b..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.0", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.0.6", - "@stdlib/random-base-uniform": "^0.0.6", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..4935b7c --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..2456043 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 81c5074aa7d43d0e54d2b6939943a994920457cf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:29:37 +0000 Subject: [PATCH 11/78] Update README.md for UMD bundle v0.1.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 030b427..7b932bd 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.1.0-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -62,7 +62,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From 1fdd4b79054ee43923ecb156fb64ff2ef8d47374 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:29:38 +0000 Subject: [PATCH 12/78] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b932bd..9af0e3b 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +``` +The previous example will load the latest bundled code from the umd 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-binary2d/tags). For example, + ```javascript binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.1.0-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From bc1c68586f575bd87572cfe08a92f0ca784b47f4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Oct 2023 16:28:54 +0000 Subject: [PATCH 13/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8a9122b..b522b23 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.0" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1809760e05ba0bbf4b6da1b5e114e1b2bcb425dc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 3 Oct 2023 01:25:14 +0000 Subject: [PATCH 14/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 4935b7c..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 2456043..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c4a470d9194f3f314917ea3092fb0680c53c1f65 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 3 Oct 2023 01:28:33 +0000 Subject: [PATCH 15/78] Auto-generated commit --- .editorconfig | 186 - .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 | 247 - .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 | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 66 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 121 - test/test.js | 121 - 45 files changed, 12399 insertions(+), 4033 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +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 `tslint.json` files: -[tslint.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 167a1a3..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T05:15:04.170Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4f20713..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: '39 15 * * 4' - - # 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 5482435..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param value - input value -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 466a055..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index b522b23..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.0", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/ndarray-base-numel": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..528f4b9 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..06cde8d --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 11dbbc4..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 4d13b862cf6c2d381b51c5735330112e2eb1fab4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 19:34:58 +0000 Subject: [PATCH 16/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 49e18ab..c15a688 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f19d2dd24f70e40598f708146d3bf62fb1acb6ca Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Oct 2023 02:38:26 +0000 Subject: [PATCH 17/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 528f4b9..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 06cde8d..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 0a76d7aaf5dc0f1a4b418c207cc13e669617b418 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Oct 2023 02:41:36 +0000 Subject: [PATCH 18/78] Auto-generated commit --- .editorconfig | 186 - .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 | 247 - .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 | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 66 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 121 - test/test.js | 121 - 44 files changed, 12399 insertions(+), 4032 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +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 `tslint.json` files: -[tslint.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 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4f20713..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: '39 15 * * 4' - - # 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 5482435..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param value - input value -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 466a055..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index c15a688..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^0.1.0", - "@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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..6096d73 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..4b27871 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 11dbbc4..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From f5732e378b6c2832c4bfc8ebb6cc682354dad115 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 31 Oct 2023 00:45:01 +0000 Subject: [PATCH 19/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 586499a..6f288ce 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 87b14c9a6764a35154a909bbc30b656123bbcf50 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 31 Oct 2023 00:45:29 +0000 Subject: [PATCH 20/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 6096d73..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 4b27871..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1258cb9b903a2868f5c2eab9ba3929c4729ee8ab Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 31 Oct 2023 00:48:53 +0000 Subject: [PATCH 21/78] Auto-generated commit --- .editorconfig | 186 - .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 | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 66 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 44 files changed, 12399 insertions(+), 3952 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +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 `tslint.json` files: -[tslint.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 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4f20713..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: '39 15 * * 4' - - # 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 5482435..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param value - input value -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 6f288ce..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..6467862 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..0aff737 --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 2e3bf0107c5310263ab0a6a3e16fc4ec20963307 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Nov 2023 17:13:00 +0000 Subject: [PATCH 22/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 586499a..6f288ce 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 36629da4998a627bacbc3a8d7c7ecd8d56639238 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 01:32:06 +0000 Subject: [PATCH 23/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 6467862..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 0aff737..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4b5561cb60f7bfc805ffc01eb9c6adeb00476ba4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 01:35:14 +0000 Subject: [PATCH 24/78] Auto-generated commit --- .editorconfig | 186 - .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 | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 66 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 45 files changed, 12399 insertions(+), 3953 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +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 `tslint.json` files: -[tslint.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 127954e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-11-01T05:33:15.854Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4f20713..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: '39 15 * * 4' - - # 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 5482435..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param value - input value -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 6f288ce..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..72eec2e --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..9048960 --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From b091271d3d66d6c96b76437851b09e166ed09243 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 23 Nov 2023 00:57:03 +0000 Subject: [PATCH 25/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 02e52c5..7a3985d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f8b85175c769cd9a3a1cc361e52d77840dea0234 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 23 Nov 2023 01:05:46 +0000 Subject: [PATCH 26/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 72eec2e..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 9048960..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 293a15c26d4d38fd72e82a3b5f35ca47bcf0817a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 23 Nov 2023 01:08:19 +0000 Subject: [PATCH 27/78] Auto-generated commit --- .editorconfig | 186 - .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 | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 44 files changed, 12399 insertions(+), 3953 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +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 `tslint.json` files: -[tslint.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 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4f20713..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: '39 15 * * 4' - - # 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 7d333ab..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 7a3985d..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/bench": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..ad2ceda --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..0e37708 --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 0989aaed51dbd4c61152824288b98be5e78d7dfd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 13:22:02 +0000 Subject: [PATCH 28/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 02e52c5..7a3985d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8ef4c642fd876418e17ec693d187a127eaadf910 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 11:19:42 +0000 Subject: [PATCH 29/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index ad2ceda..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 0e37708..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From fd509d16217469ee62e794853838c70a8f47e554 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 11:22:22 +0000 Subject: [PATCH 30/78] 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 | 52 +- benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 45 files changed, 12399 insertions(+), 3949 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 7a49069..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T05:38:13.465Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4f20713..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: '39 15 * * 4' - - # 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 7856ab4..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' ); -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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..24f20e6 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 7d333ab..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..b8802c9 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 7a3985d..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/bench": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..7f8c545 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..9a9174e --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 2cda583a288de55bd9e7dd6f71c586761895f07b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 07:58:25 +0000 Subject: [PATCH 31/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0266114..1841a52 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 28e0cce07c03855f0e4776c7797be8ee92b3dac9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 14:34:37 +0000 Subject: [PATCH 32/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 24f20e6..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index b8802c9..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 7f8c545..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 9a9174e..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a8872360d4601d16a25c8363512a5903f24b198b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 14:35:04 +0000 Subject: [PATCH 33/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 46 files changed, 12399 insertions(+), 3955 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 328f916..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T05:07:38.334Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 fed679b..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: '39 15 * * 4' - - # 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 7d333ab..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( `@stdlib/array/base/ones2d` ); -* var zeros2d = require( `@stdlib/array/base/zeros2d` ); -* var add = require( `@stdlib/math/base/ops/add` ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 1841a52..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..af177c8 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..8ecb488 --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 1e7da50c0b19c8b02a44d8a29f4d9f67c7269a4b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:05:25 +0000 Subject: [PATCH 34/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0266114..1841a52 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8ca63b7e26a0870c49943342ba29754045269dc1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:16:52 +0000 Subject: [PATCH 35/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index af177c8..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 8ecb488..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 13f85842614ab9c5199403a271e73be0c9bec6d8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:17:27 +0000 Subject: [PATCH 36/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 53 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 45 files changed, 12399 insertions(+), 3954 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 fed679b..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: '39 15 * * 4' - - # 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 +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -110,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7300e25..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 1841a52..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..60778b3 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..747b465 --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 2634a779f44fa669bc617087c038961524ac0d15 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 08:28:40 +0000 Subject: [PATCH 37/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0266114..1841a52 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.1.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From cdd3976b759fa17f42eedfea249b5505a246c72a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 13:51:02 +0000 Subject: [PATCH 38/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 60778b3..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 747b465..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c7d126595bdc5851cb090b10dbedcf2dae807dec Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 13:51:26 +0000 Subject: [PATCH 39/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 46 files changed, 12398 insertions(+), 3959 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 bfad36e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T05:56:28.027Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 fed679b..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 1841a52..6bf6fc0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.1.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.1.0", - "@stdlib/array-base-zeros2d": "^0.1.0", - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/math-base-ops-add": "^0.1.0", - "@stdlib/math-base-special-floor": "^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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..b4adba6 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..777f6bc --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 9457e9c8d83ca10375b51f2e148cc81ebc1c29e5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 00:03:43 +0000 Subject: [PATCH 40/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2ef292b..2d9f198 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.3.1" + "@stdlib/types": "^0.3.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.0", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 4f7fd0af54274b5ddb8a5f2f82a9db0529b3e82a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 02:45:23 +0000 Subject: [PATCH 41/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index b4adba6..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 777f6bc..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e26c825e15e977af350c5f18808e077d6a9249ce Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 02:46:34 +0000 Subject: [PATCH 42/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 45 files changed, 12398 insertions(+), 3962 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 adaa5bb..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 2d9f198..c683b90 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.0", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.0", - "@stdlib/array-base-zeros2d": "^0.2.0", - "@stdlib/math-base-assert-is-nan": "^0.2.0", - "@stdlib/math-base-ops-add": "^0.2.0", - "@stdlib/math-base-special-floor": "^0.2.0", - "@stdlib/math-base-special-pow": "^0.2.0", - "@stdlib/ndarray-base-numel": "^0.2.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/random-base-uniform": "^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.2.0" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..9927c1e --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..7d45207 --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 4c8d2987b0a1a44a3b054a83a04660f53023fe4c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:30:43 +0000 Subject: [PATCH 43/78] Update README.md for UMD bundle v0.2.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a93afa3..8f52694 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.2.0-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -62,7 +62,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From d80a39311781fcd73f13fad4183b7d157857015e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:30:43 +0000 Subject: [PATCH 44/78] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f52694..ab2d417 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +``` +The previous example will load the latest bundled code from the umd 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-binary2d/tags). For example, + ```javascript binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.2.0-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From 7268992d4a208b1a0ffaa4db0d090fce91a44037 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 18:57:53 +0000 Subject: [PATCH 45/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 289f88b..6225812 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.1", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 21b28c5a54f7435241a46d6440262afc3bb453a0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 19:29:27 +0000 Subject: [PATCH 46/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 6177 -------------------------------------------- stats_node.html | 6177 -------------------------------------------- 6 files changed, 12362 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 9927c1e..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index 7d45207..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a2edad1adc06934389ddb468e500d1af496ccab9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 19:31:02 +0000 Subject: [PATCH 47/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 45 files changed, 9728 insertions(+), 3956 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 6225812..68a3e03 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.1", - "@stdlib/array-base-zeros2d": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/math-base-ops-add": "^0.2.1", - "@stdlib/math-base-special-floor": "^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.0", - "@stdlib/random-base-uniform": "^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.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 28920373bbd685a11465097b0812c444f1f6a6b1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 20:00:09 +0000 Subject: [PATCH 48/78] Update README.md for UMD bundle v0.2.1 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2b0daf..ce68aa7 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.2.1-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -62,7 +62,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From ea272b685c1c7690084868e49d3dbe8fb82b71f5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 20:00:10 +0000 Subject: [PATCH 49/78] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce68aa7..3d069de 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +``` +The previous example will load the latest bundled code from the umd 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-binary2d/tags). For example, + ```javascript binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.2.1-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From b1bf5988a8751b50671ad257a462984de11c6006 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 07:48:49 +0000 Subject: [PATCH 50/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index af4e6ce..5c3ff65 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.1", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d72d310b40e15a7423912c41ffda1714d991687e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 13:28:41 +0000 Subject: [PATCH 51/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 273b40f34dd4d9a111890213b30306262db83262 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 13:29:03 +0000 Subject: [PATCH 52/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 46 files changed, 9728 insertions(+), 3958 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 8911095..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T05:38:11.327Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 5c3ff65..68a3e03 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.1", - "@stdlib/array-base-zeros2d": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/math-base-ops-add": "^0.2.1", - "@stdlib/math-base-special-floor": "^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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 0555690e284d7034f029bafc2ce4f046432f03ac Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 07:06:50 +0000 Subject: [PATCH 53/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dc265d0..779332d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.1", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 482df49bac975d3dd818ea8d9950bd79eeded9fc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 12:24:34 +0000 Subject: [PATCH 54/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4f38b159a38dc52108ee4f5f5ee7e6fe59b47402 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 12:24:52 +0000 Subject: [PATCH 55/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 46 files changed, 9728 insertions(+), 3961 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 b7bea3b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T04:56:40.734Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 779332d..68a3e03 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.1", - "@stdlib/array-base-zeros2d": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/math-base-ops-add": "^0.2.1", - "@stdlib/math-base-special-floor": "^0.2.2", - "@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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 462fe3c378734949fc136b16b0d52147eaabdc52 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 03:22:58 +0000 Subject: [PATCH 56/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dc265d0..779332d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.1", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From cdb962723f07ac69d9ceebfdd4c87f80d2c449d3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 08:46:47 +0000 Subject: [PATCH 57/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 669c790f78826f0a4c680c0e48c5deb5770b0375 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 08:47:12 +0000 Subject: [PATCH 58/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 45 files changed, 9728 insertions(+), 3962 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 779332d..68a3e03 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.1", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.1", - "@stdlib/array-base-zeros2d": "^0.2.1", - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/math-base-ops-add": "^0.2.1", - "@stdlib/math-base-special-floor": "^0.2.2", - "@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", - "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", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From ab3dfc69f6cf1570e10ea8b60dd594410ff484f6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:37:36 +0000 Subject: [PATCH 59/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 742f66f..9e47c56 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.2", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 530cb5735c2b441706f1477733a60e339c541466 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:44:43 +0000 Subject: [PATCH 60/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ab2f235c789c51474ff01d7afc5500edffdc693c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:44:59 +0000 Subject: [PATCH 61/78] 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 | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 107 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 45 files changed, 9728 insertions(+), 4077 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 9e47c56..232e263 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.2", - "@stdlib/array-base-zeros2d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-ops-add": "^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/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From c18651a306a1cb3718fbc85cd1a99b366e985624 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:49:06 +0000 Subject: [PATCH 62/78] Update README.md for UMD bundle v0.2.2 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e7ada4..e21fa65 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.2.2-umd/browser.js' ) ``` To vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build: @@ -62,7 +62,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From 787f746ba2b54bdedf34c659f5f23060738a99ef Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:49:07 +0000 Subject: [PATCH 63/78] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e21fa65..ab6be7f 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@umd/browser.js' ) +``` +The previous example will load the latest bundled code from the umd 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-binary2d/tags). For example, + ```javascript binary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-binary2d@v0.2.2-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var binary2d = require( 'path/to/vendor/umd/array-base-binary2d/index.js' ) To include the bundle in a webpage, ```html - + ``` If no recognized module system is present, access bundle contents via the global scope: From b788569aabfa2d3dcb339ec9d3fbb81f44defe41 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 07:54:04 +0000 Subject: [PATCH 64/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 742f66f..9e47c56 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.2", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 67ee2a9051b1627bfe3e6c4fcc0ef020132b2ccc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 12:46:46 +0000 Subject: [PATCH 65/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b209af25f77326ac1d3db11f04767cb5c76a2472 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 12:47:03 +0000 Subject: [PATCH 66/78] 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 | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 46 files changed, 9728 insertions(+), 4049 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 7dd6712..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T05:48:00.064Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 9e47c56..232e263 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.2", - "@stdlib/array-base-zeros2d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-ops-add": "^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/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 986e5025b5588a738bc2a7b20b3ff222562a8ea2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 08:17:36 +0000 Subject: [PATCH 67/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a88ee9d..37df4c3 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.2", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From df88d6281676683dfe2c18d1d6ee9c6e19fc9fc3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 12:42:50 +0000 Subject: [PATCH 68/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c35a28cd97c0efa6c95517ce0cde765b443bc6d0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 12:43:10 +0000 Subject: [PATCH 69/78] 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 | 107 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 46 files changed, 9728 insertions(+), 4078 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 ee4ba83..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T06:14:19.939Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 37df4c3..232e263 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.2", - "@stdlib/array-base-zeros2d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-ops-add": "^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/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From b8aabf76e99b8d843350a4a241594735d4b09f4d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 08:34:29 +0000 Subject: [PATCH 70/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a88ee9d..37df4c3 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.2", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From da8f671d33b8eea797ee06923805c7ee9412fc02 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 13:16:06 +0000 Subject: [PATCH 71/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 36853a337e83248940b696b4462d8c89327b86d7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 13:16:22 +0000 Subject: [PATCH 72/78] 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 | 107 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 46 files changed, 9728 insertions(+), 4078 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 711d233..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T06:26:29.893Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 37df4c3..232e263 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.2", - "@stdlib/array-base-zeros2d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-ops-add": "^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/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 34fe7d32f1865cc71a739cb0fde3d0ec04d1dcb2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 08:21:32 +0000 Subject: [PATCH 73/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a88ee9d..37df4c3 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.2", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1fda587c60d8deee4f39ee315d9fc57a40f34b53 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 12:20:34 +0000 Subject: [PATCH 74/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6dd7bde0974b4810f2b9f9f9a7e4e5bba3d17f88 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 12:20:49 +0000 Subject: [PATCH 75/78] 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 | 107 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 46 files changed, 9728 insertions(+), 4078 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 130e22a..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T06:29:37.227Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 37df4c3..232e263 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.2", - "@stdlib/array-base-zeros2d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-ops-add": "^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/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 2b07530cda17f7a4ce0d9f331113fd70edaf052a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 08:38:06 +0000 Subject: [PATCH 76/78] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6f34c93..7b848b0 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-filled2d-by": "^0.2.2", @@ -88,4 +89,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 6f2eeb75f0157b672e8ef42a17f378602ab9909d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 12:44:43 +0000 Subject: [PATCH 77/78] Remove files --- browser.js | 3 - browser.js.map | 1 - index.js | 3 - index.js.map | 1 - stats_browser.html | 4842 -------------------------------------------- stats_node.html | 4842 -------------------------------------------- 6 files changed, 9692 deletions(-) delete mode 100644 browser.js delete mode 100644 browser.js.map delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 stats_browser.html delete mode 100644 stats_node.html diff --git a/browser.js b/browser.js deleted file mode 100644 index 7a23337..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 7e3534a..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index e5975d7..0000000 --- a/stats_browser.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - diff --git a/stats_node.html b/stats_node.html deleted file mode 100644 index de5bf0c..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 217794d59b66c7872afac915cc05b09f70a36977 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 12:45:00 +0000 Subject: [PATCH 78/78] 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 | 107 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 118 - branches.md | 56 - browser.js | 3 + browser.js.map | 1 + dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 31 - docs/types/index.d.ts | 67 - docs/types/test.ts | 96 - examples/index.js | 39 - index.js | 3 + index.js.map | 1 + lib/index.js | 51 - lib/main.js | 84 - package.json | 63 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 121 - 47 files changed, 9728 insertions(+), 4183 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.js delete mode 100644 branches.md create mode 100644 browser.js create mode 100644 browser.js.map 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/index.d.ts delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js create mode 100644 index.js create mode 100644 index.js.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats_browser.html create mode 100644 stats_node.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 5a6b3e2..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T06:39:21.317Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 30c1286..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/binary2d) 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 0713f3f..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/binary2d) 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 4cc9987..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: '39 15 * * 4' - - # 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 +``` -```javascript -var binary2d = require( '@stdlib/array-base-binary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### binary2d( arrays, shape, fcn ) @@ -112,8 +118,13 @@ The function accepts the following arguments: -```javascript -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; +```html + + + + + + + ```
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.js b/benchmark/benchmark.js deleted file mode 100644 index 025ca61..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 add = require( '@stdlib/math-base-ops-add' ); -var filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var pkg = require( './../package.json' ).name; -var binary2d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var x; - var y; - var z; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - binary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 2 ][ 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/2.0 ) ); - sh = [ N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 7eb646b..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/binary2d" -%% click B href "https://github.com/stdlib-js/array-base-binary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-binary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-binary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-binary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-binary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/binary2d -[production-url]: https://github.com/stdlib-js/array-base-binary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-binary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-binary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-binary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-binary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..7a23337 --- /dev/null +++ b/browser.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index fc707aa..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import binary2d from '../docs/types/index'; -export = binary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 4253822..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var b=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var z=b(function(q,s){ -function d(a,r,S){var t,e,v,i,n,o,u,f,x,c;if(t=r[1],e=r[0],!(t<=0||e<=0))for(f=a[0],x=a[1],c=a[2],i=0;i>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = binary2d;\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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-binary2d\n*\n* @example\n* var ones2d = require( '@stdlib/array-base-ones2d' );\n* var zeros2d = require( '@stdlib/array-base-zeros2d' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var binary2d = require( '@stdlib/array-base-binary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAkDA,SAASC,EAAUC,EAAQC,EAAOC,EAAM,CACvC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,CAAE,EACdW,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,CAAG,EACXE,EAAKG,EAAGL,CAAG,EACXG,EAAKG,EAAGN,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,CAGtC,CAKAP,EAAO,QAAUC,ICtCjB,IAAIc,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "binary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "x", "y", "z", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index bdb0c44..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays and assigns results to elements in a two-dimensional nested output - array. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays and one output - nested array. - - shape: Array - Array shape. - - fcn: Function - Binary callback. - - Examples - -------- - > var x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 4.0 ], [ 6.0, 8.0 ] ] - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 8f44a06..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Array2D } from '@stdlib/types/array'; -import { Shape2D } from '@stdlib/types/ndarray'; - -/** -* Binary callback. -* -* @param v1 - element from first input array -* @param v2 - element from second input array -* @returns result -*/ -type Binary = ( v1: T, v2: U ) => V; - -/** -* Applies a binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param arrays - array containing two input nested arrays and one output nested array -* @param shape - array shape -* @param fcn - binary callback -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -declare function binary2d( arrays: [ Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = binary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 1e99acf..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,96 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 binary2d = require( './index' ); - -/** -* Binary function. -* -* @param x - input value -* @param y - input value -* @returns result -*/ -function fcn( x: number, y: number ): number { - return x + y; -} - - -// TESTS // - -// The function returns undefined... -{ - const x = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], fcn ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... -{ - binary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - binary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - binary2d( true, [ 2, 2 ], fcn ); // $ExpectError - binary2d( false, [ 2, 2 ], fcn ); // $ExpectError - binary2d( null, [ 2, 2 ], fcn ); // $ExpectError - binary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - binary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - binary2d( ( x: number ): number => x, [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], 'abc', fcn ); // $ExpectError - binary2d( [ x, y, z ], 3.14, fcn ); // $ExpectError - binary2d( [ x, y, z ], true, fcn ); // $ExpectError - binary2d( [ x, y, z ], false, fcn ); // $ExpectError - binary2d( [ x, y, z ], null, fcn ); // $ExpectError - binary2d( [ x, y, z ], [ '1' ], fcn ); // $ExpectError - binary2d( [ x, y, z ], {}, fcn ); // $ExpectError - binary2d( [ x, y, z ], ( 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d( [ x, y, z ], [ 2, 2 ], 'abc' ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], 3.14 ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], true ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], false ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], null ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - binary2d( [ x, y, z ], [ 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 ] ]; - const y = [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - binary2d(); // $ExpectError - binary2d( [ x, y, z ] ); // $ExpectError - binary2d( [ x, y, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index a92eb1d..0000000 --- a/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 filled2dBy = require( '@stdlib/array-base-filled2d-by' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var add = require( '@stdlib/math-base-ops-add' ); -var binary2d = require( './../lib' ); - -var shape = [ 3, 3 ]; - -var x = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( x ); - -var y = filled2dBy( shape, discreteUniform( -100, 100 ) ); -console.log( y ); - -var z = zeros2d( shape ); -console.log( z ); - -binary2d( [ x, y, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7e3534a --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +var e,f;e=this,f=function(){"use strict";return function(e,f,o){var n,i,t,d,r,u,s,l,a,p;if(n=f[1],i=f[0],!(n<=0||i<=0))for(l=e[0],a=e[1],p=e[2],d=0;d>} arrays - array-like object containing two input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - binary callback\n* @returns {void}\n*\n* @example\n* import ones2d from '@stdlib/array-base-ones2d';\n* import zeros2d from '@stdlib/array-base-zeros2d';\n* import add from '@stdlib/math-base-ops-add';\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* binary2d( [ x, y, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction binary2d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar i0;\n\tvar i1;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar x;\n\tvar y;\n\tvar z;\n\n\tS0 = shape[ 1 ];\n\tS1 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tx0 = x[ i1 ];\n\t\ty0 = y[ i1 ];\n\t\tz0 = z[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default binary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","x","y","z"],"mappings":";gDAkDA,SAAmBA,EAAQC,EAAOC,GACjC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAT,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAMtB,IAHAM,EAAIV,EAAQ,GACZW,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAItB,IAHAC,EAAKG,EAAGJ,GACRE,EAAKG,EAAGL,GACRG,EAAKG,EAAGN,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACtBI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,GAGjC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 65fe5d2..0000000 --- a/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-binary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var binary2d = require( '@stdlib/array-base-binary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b955901..0000000 --- a/lib/main.js +++ /dev/null @@ -1,84 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 binary callback to elements in two two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array. -* -* ## Notes -* -* - The function assumes that the input and output arrays have the same shape. -* -* @param {ArrayLikeObject>} arrays - array-like object containing two input nested arrays and one output nested array -* @param {NonNegativeIntegerArray} shape - array shape -* @param {Callback} fcn - binary callback -* @returns {void} -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* binary2d( [ x, y, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] -*/ -function binary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var x; - var y; - var z; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } -} - - -// EXPORTS // - -module.exports = binary2d; diff --git a/package.json b/package.json index 7b848b0..232e263 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,7 @@ "version": "0.2.2", "description": "Apply a binary callback to elements in two two-dimensional nested input arrays and assign results to elements in a two-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" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,40 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-filled2d-by": "^0.2.2", - "@stdlib/array-base-zeros2d": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-ops-add": "^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/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-uniform": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -84,9 +26,8 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..e5975d7 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..de5bf0c --- /dev/null +++ b/stats_node.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.js b/test/test.js deleted file mode 100644 index 9b6c67e..0000000 --- a/test/test.js +++ /dev/null @@ -1,121 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 add = require( '@stdlib/math-base-ops-add' ); -var zeros2d = require( '@stdlib/array-base-zeros2d' ); -var binary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof binary2d, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a provided callback to nested input arrays and assigns results to a nested output array', function test( t ) { - var expected; - var shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = [ - [ 6.0, 8.0 ], - [ 10.0, 12.0 ] - ]; - binary2d( [ x, y, z ], shape, add ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 0, 2 ], clbk ); - - t.deepEqual( z, 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 shape; - var x; - var y; - var z; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - - expected = zeros2d( shape ); - binary2d( [ x, y, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -});