From e071c6c0ba53a35bc445ed8acf83a7012d11b3bb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Sep 2023 04:27:32 +0000 Subject: [PATCH 01/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 846ca65..0528dc6 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f153f55127d5779a27bde3f5d4ba13399beeabe6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Sep 2023 04:29:28 +0000 Subject: [PATCH 02/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 69 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 159 - 43 files changed, 12399 insertions(+), 3920 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 f8ba45e..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/mskbinary2d) 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 d6600b3..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/mskbinary2d) 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 c536ed0..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - 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 + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 4b2f05d..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..54d203e --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 be01a3c..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..168aa5c --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 0528dc6..b6f7371 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^0.0.6", - "@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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..549630f --- /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..7d2b889 --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 0b69b17baa5efc59f10813ff5116a8d691887158 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 06:38:07 +0000 Subject: [PATCH 03/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e34b850..8f62baa 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.0.1", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e9bdb8a1e044a36bab7cb58f44b7212501204587 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 08:55:39 +0000 Subject: [PATCH 04/76] 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 54d203e..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 168aa5c..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 549630f..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 7d2b889..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1ccad3f3a296194b435fcae7c7e0dba6aed6e48b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 08:57:42 +0000 Subject: [PATCH 05/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 69 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/test.js | 159 - 43 files changed, 12399 insertions(+), 3920 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 f8ba45e..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/mskbinary2d) 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 d6600b3..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/mskbinary2d) 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 c536ed0..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - 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 + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 4b2f05d..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..54d203e --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 be01a3c..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..168aa5c --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 8f62baa..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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.0.1", - "@stdlib/array-base-zeros2d": "github:stdlib-js/array-base-zeros2d#main", - "@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-bernoulli": "^0.0.6", - "@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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..fc70d00 --- /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..f7b5c88 --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From d93f9ae1ef2a7f37919e940dcf9a173288244a88 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 10:43:57 +0000 Subject: [PATCH 06/76] 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 6e09cca..916c4e5 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@umd/browser.js' ) +mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@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 mskbinary2d = require( 'path/to/vendor/umd/array-base-mskbinary2d/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 cf4d090b649d1e041b6db5d563f53eda8a1b157a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 10:43:58 +0000 Subject: [PATCH 07/76] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 916c4e5..acc33a5 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@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-mskbinary2d/tags). For example, + ```javascript mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.1.0-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var mskbinary2d = require( 'path/to/vendor/umd/array-base-mskbinary2d/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 fa825e7d0dab92f4c4dcc6cbe6ea8d7988e4eb5d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Oct 2023 14:15:56 +0000 Subject: [PATCH 08/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1c1c405..6d17e32 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 037e2dcbf446634ba225a0957b86cdb328ab36ab Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Oct 2023 22:13:40 +0000 Subject: [PATCH 09/76] 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 54d203e..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 168aa5c..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index fc70d00..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 f7b5c88..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4d5df3a612575e726521485fef0a7eaf31405c36 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Oct 2023 22:16:45 +0000 Subject: [PATCH 10/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 69 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 159 - test/test.js | 159 - 45 files changed, 12399 insertions(+), 4138 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 6de90ea..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T04:21:24.933Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 dcbc098..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 4b2f05d..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..54d203e --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 be01a3c..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..168aa5c --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 6d17e32..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..df2f2e0 --- /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..5fea43a --- /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 3052988..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 967fa9179d72a7da22763aeb5793811f02343744 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 17:41:30 +0000 Subject: [PATCH 11/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 27a90cb..ba84c78 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From fc664b9820538eab0580e92f35b9c73562081ee5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 23:33:57 +0000 Subject: [PATCH 12/76] 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 54d203e..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 168aa5c..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index df2f2e0..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 5fea43a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 92d525feb58fc1b0d109e58b4c817ef0b42dfa99 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 23:37:57 +0000 Subject: [PATCH 13/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 69 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 159 - test/test.js | 159 - 44 files changed, 12399 insertions(+), 4137 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 f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 dcbc098..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 4b2f05d..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..54d203e --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 be01a3c..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..168aa5c --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index ba84c78..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..256f287 --- /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..6c7f9a1 --- /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 3052988..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From ab7a3e507b479083132759f921cf95ebfab3c31b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Nov 2023 15:16:20 +0000 Subject: [PATCH 14/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2e0176b..9bcdf56 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e743c3a7114cce8992c16e4119c8ffa0b23413d4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 22:32:56 +0000 Subject: [PATCH 15/76] 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 54d203e..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 168aa5c..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 256f287..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 6c7f9a1..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a35572bd51fc595c3802df16c3a798cab2cfe7ae Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 22:35:25 +0000 Subject: [PATCH 16/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 69 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 45 files changed, 12399 insertions(+), 4020 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 01991b8..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-11-01T04:36:33.782Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 dcbc098..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 4b2f05d..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..54d203e --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 be01a3c..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..168aa5c --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 9bcdf56..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..d8874f7 --- /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..da0e323 --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From fc6d193d109013dee87e90f250104f4ab01a5e51 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 23 Nov 2023 01:01:16 +0000 Subject: [PATCH 17/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b5810ba..07a78d3 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c5fd5d5db56d6ed349ca848e29eac57ab07526db Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 23 Nov 2023 01:15:09 +0000 Subject: [PATCH 18/76] 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 54d203e..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 168aa5c..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index d8874f7..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 da0e323..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4fbb4ae59aa39acc6381e6cbf142890bf836d12f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 23 Nov 2023 01:17:58 +0000 Subject: [PATCH 19/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 44 files changed, 12399 insertions(+), 4020 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 f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 dcbc098..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 4b2f05d..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..54d203e --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 13f2075..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..168aa5c --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 07a78d3..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..2952a5d --- /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..d773af7 --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 3a8ff99b4532dde305aacd0221c1f6360314a495 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 11:36:30 +0000 Subject: [PATCH 20/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b5810ba..07a78d3 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From dbd44345e9d5d98da7df4bc56ae63179382c6d7e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 08:45:56 +0000 Subject: [PATCH 21/76] 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 54d203e..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 168aa5c..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 2952a5d..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 d773af7..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 83c6b1d5a610b7702093617a14c65bd80cbe8f75 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 08:48:39 +0000 Subject: [PATCH 22/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 45 files changed, 12399 insertions(+), 4016 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 66d158f..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T04:47:24.676Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 dcbc098..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 4b2f05d..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..54d203e --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 13f2075..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..168aa5c --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 07a78d3..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..7c489a2 --- /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..5a6bc0a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 8c5a9f46520d82ff424c3bbb5db30672ccce5066 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 06:53:09 +0000 Subject: [PATCH 23/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9f5eb09..6c7b950 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 0b6400c3e0e7616fa4e61bd55ed7aeb42d9122dc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 13:37:11 +0000 Subject: [PATCH 24/76] 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 54d203e..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 168aa5c..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 7c489a2..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 5a6bc0a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c0469afcf6ebbf3242f7994149f49ae95e004f89 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 13:37:30 +0000 Subject: [PATCH 25/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 12399 insertions(+), 4022 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 86976b4..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T04:13:46.333Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 adf9dcd..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 13f2075..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 6c7b950..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", - "@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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..3b13da3 --- /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..1b257b0 --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 86fb7f37b34b0003133093824f9d277e65011b3b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:11:58 +0000 Subject: [PATCH 26/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9f5eb09..6c7b950 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 855f88b95d2ace3496778f20a74bdfa221d9220c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:21:01 +0000 Subject: [PATCH 27/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 3b13da3..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 1b257b0..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b0ed9ea4dc9038b4b3a2783ebf9a5f405b43cdca Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:21:26 +0000 Subject: [PATCH 28/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 45 files changed, 12399 insertions(+), 4021 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 f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 adf9dcd..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` + +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -112,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 a993c28..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 6c7b950..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", - "@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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..83df008 --- /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..0769fe0 --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 5b8953b0cbd74f0b1e03dd6349fa87440f156869 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 07:22:53 +0000 Subject: [PATCH 29/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9f5eb09..6c7b950 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e87b9aa9cd1cc48e0099b3425b3b4029ad8f5d89 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 12:55:08 +0000 Subject: [PATCH 30/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 83df008..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 0769fe0..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 38729c9dc95f633703b22808fd2f1b03f4e1f405 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 12:55:28 +0000 Subject: [PATCH 31/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 12398 insertions(+), 4026 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 96de26d..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T05:02:52.635Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 adf9dcd..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 6c7b950..b2ce657 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", - "@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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..5eaeb01 --- /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..804e1f7 --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From f390f18ec32d8ac5c67cff7989c6e7f40a8c8977 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 14:06:46 +0000 Subject: [PATCH 32/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4e42a66..943bebb 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.1.0", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d659f95538daf0db0c5a8c968874ba2e9632051d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 21:05:11 +0000 Subject: [PATCH 33/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 5eaeb01..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 804e1f7..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8f22c4d500e175960d588c02efee2067c109cee1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 21:06:05 +0000 Subject: [PATCH 34/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 6177 +++++++++++++++++++++ stats_node.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 45 files changed, 12398 insertions(+), 4029 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 f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 1068783..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 943bebb..6989db7 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 according to elements in a two-dimensional nested mask array 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,41 +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.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-bernoulli": "^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", - "@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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..316332a --- /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..44641b9 --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From c915fa7639eeb7b7d1d4969612955463b716d3cc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 22:10:31 +0000 Subject: [PATCH 35/76] 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 1647e63..36bee6f 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@umd/browser.js' ) +mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@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 mskbinary2d = require( 'path/to/vendor/umd/array-base-mskbinary2d/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 fc284addfa25a739d81debcba9feb3a6e1b000a7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 22:10:31 +0000 Subject: [PATCH 36/76] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 36bee6f..57a1104 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@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-mskbinary2d/tags). For example, + ```javascript mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.0-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var mskbinary2d = require( 'path/to/vendor/umd/array-base-mskbinary2d/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 fd8fd44e62bfca46279f86eefd33e7038dc32bed Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 00:16:30 +0000 Subject: [PATCH 37/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1e95c35..69d6ae3 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.0", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 6a4e746667d288778d9739ac6f70883bd3f65136 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 05:43:02 +0000 Subject: [PATCH 38/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 316332a..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 44641b9..0000000 --- a/stats_node.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 9e1768590929109b35d67e1723b6921dd78e5cbb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 05:44:41 +0000 Subject: [PATCH 39/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 45 files changed, 9728 insertions(+), 4023 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 f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 69d6ae3..6bc7c35 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 according to elements in a two-dimensional nested mask array 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,41 +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.0", - "@stdlib/array-base-zeros2d": "^0.2.0", - "@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.0", - "@stdlib/ndarray-base-numel": "^0.2.1", - "@stdlib/random-base-bernoulli": "^0.2.0", - "@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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 61e52048adf6d0e9d7af0e968857a0b618b609e4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 07:25:28 +0000 Subject: [PATCH 40/76] 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 365bb15..61206e2 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@umd/browser.js' ) +mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@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 mskbinary2d = require( 'path/to/vendor/umd/array-base-mskbinary2d/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 6e1790857f0e6138b7e016afbf0a8e9fac06cce3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 07:25:29 +0000 Subject: [PATCH 41/76] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 61206e2..488dd3d 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@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-mskbinary2d/tags). For example, + ```javascript mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.1-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var mskbinary2d = require( 'path/to/vendor/umd/array-base-mskbinary2d/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 909c520878ec6d0a69344f810f2f2a3c6c0a0455 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 06:45:14 +0000 Subject: [PATCH 42/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cf90aa8..393c886 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 3c1934903a176d12de15cef57022dd41818ed784 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 12:00:25 +0000 Subject: [PATCH 43/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5c27e53727e1a324f4b8a6b22e8e1b4f88361c42 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 12:00:44 +0000 Subject: [PATCH 44/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 9728 insertions(+), 4025 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 6e5edd4..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T04:49:36.093Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 393c886..6bc7c35 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 9b603672b08f5a55b11670599827218820ef7ded Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 06:02:05 +0000 Subject: [PATCH 45/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 91f47a4..00735f3 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 94227bd6de58ae22de97c28f581a900ea0db2405 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 11:11:17 +0000 Subject: [PATCH 46/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1b4690c34d0c6c4d71e94b83c989d2dedc0a9d0d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 11:11:30 +0000 Subject: [PATCH 47/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 9728 insertions(+), 4028 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 c9d3ed6..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T04:05:03.298Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 00735f3..6bc7c35 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From e93c23cf4c8216d36a8f480b0e05f41bb52cb665 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 02:24:49 +0000 Subject: [PATCH 48/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 91f47a4..00735f3 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1a6ac8c3b138c6d63d88d60a7b5cc1729138f174 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 07:53:13 +0000 Subject: [PATCH 49/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6e49555a24f9bfc1a4a114abc98e3eb31bb27df6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 07:53:35 +0000 Subject: [PATCH 50/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 45 files changed, 9728 insertions(+), 4029 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 f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 00735f3..6bc7c35 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 080e34d6728da5991692b255746786de3b00d1e8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:18:51 +0000 Subject: [PATCH 51/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e272dae..f174566 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.1", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 3257932f1893848af263657abe180df4835b75a9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:33:58 +0000 Subject: [PATCH 52/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 02035711f3f1ed922e903eefef30b794eaf35345 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:34:15 +0000 Subject: [PATCH 53/76] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 104 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 45 files changed, 9728 insertions(+), 4139 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 f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index f174566..e81e043 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 according to elements in a two-dimensional nested mask array 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,41 +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.1", - "@stdlib/array-base-zeros2d": "^0.2.1", - "@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-bernoulli": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 1a30afd03797533a8b113e591c0d16d7c7e7d66a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:42:11 +0000 Subject: [PATCH 54/76] 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 8aa5478..9bdb684 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ limitations under the License. To use in Observable, ```javascript -mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@umd/browser.js' ) +mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@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 mskbinary2d = require( 'path/to/vendor/umd/array-base-mskbinary2d/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 c6de7c076e3da5663e853d78d508ef0d701d63d1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:42:12 +0000 Subject: [PATCH 55/76] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bdb684..710e603 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,11 @@ limitations under the License. To use in Observable, +```javascript +mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@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-mskbinary2d/tags). For example, + ```javascript mskbinary2d = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.2-umd/browser.js' ) ``` @@ -62,7 +67,7 @@ var mskbinary2d = require( 'path/to/vendor/umd/array-base-mskbinary2d/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 b52bac7afced71c5f7b9fc59deee1f19630d1123 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 06:52:23 +0000 Subject: [PATCH 56/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8087f6e..8af2b39 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 619639e76933953fe1d5c232c693cab6fd8529bc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 11:32:27 +0000 Subject: [PATCH 57/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c751b4ba3ca5f4898e55d71be3c385996840b092 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 11:32:41 +0000 Subject: [PATCH 58/76] 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 | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 9728 insertions(+), 4116 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 596a641..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T04:56:01.517Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 8af2b39..e81e043 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From b15927d228fb5e3a3ba275f446c9fb641b15899e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 22:03:08 +0000 Subject: [PATCH 59/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8087f6e..8af2b39 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1e1933a20f4f08af3d3fb76a29532cc87ffde180 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 4 Aug 2024 01:17:28 +0000 Subject: [PATCH 60/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From bd43ca9dbb2e41867b0f4f414ae9b531799a32a6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 4 Aug 2024 01:17:54 +0000 Subject: [PATCH 61/76] 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 | 104 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 9728 insertions(+), 4142 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 67feaed..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-03T20:23:57.243Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 8af2b39..e81e043 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 2fc86f30f5e8e2699a700c42400f4dec34e884b5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 07:10:45 +0000 Subject: [PATCH 62/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1f0672c..9eb1e26 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8d113537c0444b80b0ba0d6ff3533d5ffdba9dea Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 11:27:55 +0000 Subject: [PATCH 63/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7c2a35d580b2cf48a88bbefb6a4d19d35ab03737 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 11:28:09 +0000 Subject: [PATCH 64/76] 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 | 104 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 9728 insertions(+), 4142 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 0d76bd1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T05:15:58.226Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 9eb1e26..e81e043 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 8b640ed92d6b5d32f1d0dfd408ae34e097c0fd1c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 07:26:53 +0000 Subject: [PATCH 65/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1f0672c..9eb1e26 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From fbffb438f37794cdc3cfa0d174c335038064e87a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 12:05:36 +0000 Subject: [PATCH 66/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 59956e3d55b627d4cff687340a3c6197b61815e9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 12:05:50 +0000 Subject: [PATCH 67/76] 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 | 104 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 9728 insertions(+), 4142 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 3c084a4..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T05:27:42.621Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 9eb1e26..e81e043 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 15963072651e85d96b8d03d57713d59aa5eed5f1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 07:19:03 +0000 Subject: [PATCH 68/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1f0672c..9eb1e26 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c17e5fc6ed1d57e1ac3f052051bfee5f828fabd1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 11:17:59 +0000 Subject: [PATCH 69/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 177a35106ddf19aa382221fbd2fed85be246d036 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 11:18:15 +0000 Subject: [PATCH 70/76] 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 | 104 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 +++++++++++++++++++++ stats_node.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 9728 insertions(+), 4142 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 fbc26b4..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T05:31:37.626Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -114,8 +120,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 9eb1e26..e81e043 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 90a16faf00cd118f1c2e98232cb7464fa0cfe3ad Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 25 Nov 2024 08:16:08 +0000 Subject: [PATCH 71/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c61c6f..0beae87 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 5cbd0806da7d0cdadc5d9436a87c382d04624029 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 25 Nov 2024 08:16:32 +0000 Subject: [PATCH 72/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5f4ce9fe72ecd35d84d9055f3ce2ae93a98436dd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 25 Nov 2024 08:16:46 +0000 Subject: [PATCH 73/76] 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 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 138 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 46 files changed, 9728 insertions(+), 4280 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.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 f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -115,8 +121,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 0beae87..e81e043 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -}); From 84742078f6a3b08c014c946569bfac9c49ba80a8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 07:35:05 +0000 Subject: [PATCH 74/76] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c61c6f..0beae87 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", @@ -96,4 +97,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d6e63277fda29639d0e924a08bb74c267c11a737 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 11:28:46 +0000 Subject: [PATCH 75/76] 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 e6d4552..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 9b8c6a8..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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/stats_browser.html b/stats_browser.html deleted file mode 100644 index 99e61f4..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 4a1545a..0000000 --- a/stats_node.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4fbbad7f203b805bd4b4ee5827e2766d42e045bb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 11:28:59 +0000 Subject: [PATCH 76/76] 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 | 138 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 52 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - 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 | 35 - docs/types/index.d.ts | 70 - docs/types/test.ts | 100 - examples/index.js | 43 - index.js | 3 + index.js.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 64 +- stats_browser.html | 4842 ++++++++++++++++++ stats_node.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 47 files changed, 9728 insertions(+), 4281 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 36a0cd0..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T05:40:09.213Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index f8ba45e..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/mskbinary2d) 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 35da2f3..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/mskbinary2d) 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 2d78ebb..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: '3 15 * * 3' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n +``` -```javascript -var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### mskbinary2d( arrays, shape, fcn ) @@ -115,8 +121,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 0b1dc3e..0000000 --- a/benchmark/benchmark.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 bench = require( '@stdlib/bench-harness' ); -var uniform = require( '@stdlib/random-base-uniform' ).factory; -var bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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; - var m; - - x = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - y = filled2dBy( shape, uniform( -100.0, 100.0 ) ); - m = filled2dBy( shape, bernoulli( 0.5 ) ); - z = zeros2d( shape ); - - arrays = [ x, y, m, 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++ ) { - mskbinary2d( arrays, shape, add ); - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i1 = i % shape[ 0 ]; - i0 = i % shape[ 1 ]; - if ( isnan( arrays[ 3 ][ 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 2e7e016..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/mskbinary2d" -%% click B href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskbinary2d -[production-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskbinary2d/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskbinary2d/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..e6d4552 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 1d8bff8..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskbinary2d from '../docs/types/index'; -export = mskbinary2d; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index b007ca3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var d=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var S=d(function(g,z){ -function k(a,r,b){var t,e,v,i,f,n,o,u,m,x,c,s;if(t=r[1],e=r[0],!(t<=0||e<=0))for(m=a[0],x=a[1],c=a[3],s=a[2],i=0;i>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = mskbinary2d;\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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array.\n*\n* @module @stdlib/array-base-mskbinary2d\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 mskbinary2d = require( '@stdlib/array-base-mskbinary2d' );\n*\n* var shape = [ 2, 2 ];\n*\n* var x = ones2d( shape );\n* var y = ones2d( shape );\n* var z = zeros2d( shape );\n*\n* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.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,cAoDA,SAASC,EAAaC,EAAQC,EAAOC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,CAAE,EACdY,EAAIZ,EAAQ,CAAE,EACda,EAAIb,EAAQ,CAAE,EACdc,EAAId,EAAQ,CAAE,EACRM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,CAAG,EACXE,EAAKI,EAAGN,CAAG,EACXG,EAAKI,EAAGP,CAAG,EACXI,EAAKI,EAAGR,CAAG,EACLD,EAAK,EAAGA,EAAKF,EAAIE,IACjBK,EAAIL,CAAG,IAAM,IACjBI,EAAIJ,CAAG,EAAIH,EAAKK,EAAIF,CAAG,EAAGG,EAAIH,CAAG,CAAE,EAIvC,CAKAP,EAAO,QAAUC,IC5CjB,IAAIgB,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "mskbinary2d", "arrays", "shape", "fcn", "S0", "S1", "i0", "i1", "x0", "y0", "z0", "m0", "x", "y", "z", "m", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 6598d7c..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,35 +0,0 @@ - -{{alias}}( arrays, shape, fcn ) - Applies a binary callback to elements in two two-dimensional nested input - arrays according to elements in a two-dimensional nested mask array and - assigns results to elements in a two-dimensional nested output array. - - An element in an input array is "masked" if the corresponding element in the - mask array is non-zero. - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing two input nested arrays, an input nested - mask array, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - > var z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - > var shape = [ 2, 2 ]; - > {{alias}}( [ x, y, m, z ], shape, {{alias:@stdlib/math/base/ops/add}} ); - > z - [ [ 2.0, 0.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 fed145e..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 according to elements in a two-dimensional nested mask array 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. -* - An element in an input array is "masked" if the corresponding element in the mask array is non-zero. -* -* @param arrays - array containing two input nested arrays, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -declare function mskbinary2d( arrays: [ Array2D, Array2D, Array2D, Array2D ], shape: Shape2D, fcn: Binary ): void; - - -// EXPORTS // - -export = mskbinary2d; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c992a3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskbinary2d = 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, 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... -{ - mskbinary2d( 'abc', [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( 3.14, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( true, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( false, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( null, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( [ '1' ], [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( {}, [ 2, 2 ], fcn ); // $ExpectError - mskbinary2d( ( 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], 'abc', fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], 3.14, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], true, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], false, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], null, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ '1' ], fcn ); // $ExpectError - mskbinary2d( [ x, y, m, z ], {}, fcn ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 'abc' ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], 3.14 ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], true ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], false ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], null ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], [ '1' ] ); // $ExpectError - mskbinary2d( [ x, y, m, 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 m = [ [ 0, 1 ], [ 0, 0 ] ]; - const z = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; - - mskbinary2d(); // $ExpectError - mskbinary2d( [ x, y, m, z ] ); // $ExpectError - mskbinary2d( [ x, y, m, z ], [ 2, 2 ], fcn, {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 4bb9035..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 bernoulli = require( '@stdlib/random-base-bernoulli' ).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 mskbinary2d = 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 mask = filled2dBy( shape, bernoulli( 0.5 ) ); -console.log( mask ); - -var z = zeros2d( shape ); -console.log( z ); - -mskbinary2d( [ x, y, mask, z ], shape, add ); -console.log( z ); diff --git a/index.js b/index.js new file mode 100644 index 0000000..9b8c6a8 --- /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,s,u,l,a,p,c,y;if(n=f[1],i=f[0],!(n<=0||i<=0))for(a=e[0],p=e[1],c=e[3],y=e[2],d=0;d>} arrays - array-like object containing two input nested arrays, an input nested mask array, 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* var mask = [ [ 0, 1 ], [ 0, 0 ] ];\n*\n* mskbinary2d( [ x, y, mask, z ], shape, add );\n*\n* console.log( z );\n* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ]\n*/\nfunction mskbinary2d( 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 m0;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar m;\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[ 3 ];\n\tm = 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\tm0 = m[ i1 ];\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tif ( m0[ i0 ] === 0 ) {\n\t\t\t\tz0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default mskbinary2d;\n"],"names":["arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";gDAoDA,SAAsBA,EAAQC,EAAOC,GACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,GAFAX,EAAKF,EAAO,GACZG,EAAKH,EAAO,KACPE,GAAM,GAAKC,GAAM,GAOtB,IAJAO,EAAIX,EAAQ,GACZY,EAAIZ,EAAQ,GACZa,EAAIb,EAAQ,GACZc,EAAId,EAAQ,GACNM,EAAK,EAAGA,EAAKF,EAAIE,IAKtB,IAJAC,EAAKI,EAAGL,GACRE,EAAKI,EAAGN,GACRG,EAAKI,EAAGP,GACRI,EAAKI,EAAGR,GACFD,EAAK,EAAGA,EAAKF,EAAIE,IACJ,IAAbK,EAAIL,KACRI,EAAIJ,GAAOH,EAAKK,EAAIF,GAAMG,EAAIH,IAIlC"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 39b46e0..0000000 --- a/lib/index.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array and assign results to elements in a two-dimensional nested output array. -* -* @module @stdlib/array-base-mskbinary2d -* -* @example -* var ones2d = require( '@stdlib/array-base-ones2d' ); -* var zeros2d = require( '@stdlib/array-base-zeros2d' ); -* var add = require( '@stdlib/math-base-ops-add' ); -* var mskbinary2d = require( '@stdlib/array-base-mskbinary2d' ); -* -* var shape = [ 2, 2 ]; -* -* var x = ones2d( shape ); -* var y = ones2d( shape ); -* var z = zeros2d( shape ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.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 c46a385..0000000 --- a/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 according to elements in a two-dimensional nested mask array 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, an input nested mask array, 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 ); -* -* var mask = [ [ 0, 1 ], [ 0, 0 ] ]; -* -* mskbinary2d( [ x, y, mask, z ], shape, add ); -* -* console.log( z ); -* // => [ [ 2.0, 0.0 ], [ 2.0, 2.0 ] ] -*/ -function mskbinary2d( arrays, shape, fcn ) { - var S0; - var S1; - var i0; - var i1; - var x0; - var y0; - var z0; - var m0; - var x; - var y; - var z; - var m; - - S0 = shape[ 1 ]; - S1 = shape[ 0 ]; - if ( S0 <= 0 || S1 <= 0 ) { - return; - } - x = arrays[ 0 ]; - y = arrays[ 1 ]; - z = arrays[ 3 ]; - m = arrays[ 2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - x0 = x[ i1 ]; - y0 = y[ i1 ]; - z0 = z[ i1 ]; - m0 = m[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( m0[ i0 ] === 0 ) { - z0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ] ); - } - } - } -} - - -// EXPORTS // - -module.exports = mskbinary2d; diff --git a/package.json b/package.json index 0beae87..e81e043 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 according to elements in a two-dimensional nested mask array 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,41 +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-bernoulli": "^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.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -92,9 +33,8 @@ "missing values", "na" ], - "__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..99e61f4 --- /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..4a1545a --- /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 cadea92..0000000 --- a/test/test.js +++ /dev/null @@ -1,159 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 mskbinary2d = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskbinary2d, '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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = [ - [ 6.0, 0.0 ], - [ 10.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, z ], shape, add ); - - t.deepEqual( z, expected, 'returns expected value' ); - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 1, 0 ], - [ 1, 0 ] - ]; - - expected = [ - [ 0.0, 8.0 ], - [ 0.0, 12.0 ] - ]; - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, 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; - var m; - - shape = [ 2, 2 ]; - x = [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ]; - y = [ - [ 5.0, 6.0 ], - [ 7.0, 8.0 ] - ]; - z = zeros2d( shape ); - m = [ - [ 0, 1 ], - [ 0, 0 ] - ]; - - expected = zeros2d( shape ); - mskbinary2d( [ x, y, m, z ], [ 2, 0 ], clbk ); - - t.deepEqual( z, expected, 'returns expected value' ); - t.end(); - - function clbk() { - t.ok( false, 'should not invoke callback' ); - } -});