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 70be035415833ce991fbf351c0fb84a575e7d3cc 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 | 47 +- benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 159 - 40 files changed, 6206 insertions(+), 3862 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index be01a3c..26c6139 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d42f449 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..26f2820 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4d32c32 --- /dev/null +++ b/stats.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 cb5c734ba00bc33a9edfe3378220f82db1a65186 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 08:55:48 +0000 Subject: [PATCH 04/76] Remove files --- index.d.ts | 69 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6251 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 26c6139..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d42f449..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index 4d32c32..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5707d126d0321429ba2a13f2700213c99d1f9a64 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 08:57:40 +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 | 47 +- benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 159 - 40 files changed, 6206 insertions(+), 3862 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index be01a3c..26c6139 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d42f449 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c568ee5 --- /dev/null +++ b/stats.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 3786d257b3a6351e6be40569b5fba438e8a4c4ef Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 10:43:59 +0000 Subject: [PATCH 06/76] Update README.md for ESM bundle v0.1.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40b45dd..3e6f279 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ limitations under the License. ## Usage ```javascript -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.1.0-esm/index.mjs'; ``` #### mskbinary2d( arrays, shape, fcn ) @@ -107,7 +107,7 @@ var bernoulli = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-bern import filled2dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled2d-by@esm/index.mjs'; import zeros2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zeros2d@esm/index.mjs'; import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-ops-add@esm/index.mjs'; -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.1.0-esm/index.mjs'; var shape = [ 3, 3 ]; From 708c7a9e7bd7f25684fc9d7abe1906259c67fc15 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 10:44:00 +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 3e6f279..9b4c22e 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-mskbinary2d/tags). For example, + ```javascript import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.1.0-esm/index.mjs'; ``` @@ -107,7 +112,7 @@ var bernoulli = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-bern import filled2dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled2d-by@esm/index.mjs'; import zeros2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zeros2d@esm/index.mjs'; import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-ops-add@esm/index.mjs'; -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.1.0-esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; var shape = [ 3, 3 ]; 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 03b77da7a75ce591b8c925ad5b5282c467533fcd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Oct 2023 22:13:34 +0000 Subject: [PATCH 09/76] Remove files --- index.d.ts | 69 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6251 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 26c6139..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d42f449..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index c568ee5..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 37790ad50452525ee296ce03c344581de4c4148b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Oct 2023 22:17:03 +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 | 47 +- benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 159 - test/test.js | 159 - 42 files changed, 6206 insertions(+), 4080 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index be01a3c..26c6139 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d42f449 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20cb950 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 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 e098cdb918a4c662bb84576d193d59786139c57c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 23:33:55 +0000 Subject: [PATCH 12/76] Remove files --- index.d.ts | 69 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6251 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 26c6139..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d42f449..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index 20cb950..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b4a3c84db52e0e2d150c2e43f8cb1cec54707bec Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 23:37:06 +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 | 47 +- benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 159 - test/test.js | 159 - 41 files changed, 6206 insertions(+), 4079 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index be01a3c..26c6139 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d42f449 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..d949344 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 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 c17bad6c649915d33d19b22c5b59dd00deaf1dbf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 22:33:03 +0000 Subject: [PATCH 15/76] Remove files --- index.d.ts | 69 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6251 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 26c6139..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d42f449..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index d949344..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f0f5ad05f566d8ce88a5b26ee00fc4f6e98a6111 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 22:36:41 +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 | 47 +- benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 42 files changed, 6206 insertions(+), 3962 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index be01a3c..26c6139 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d42f449 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..5b34124 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 a43d7a821f019eb9c8e13615865bdb4289ec0faa Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 23 Nov 2023 01:15:16 +0000 Subject: [PATCH 18/76] Remove files --- index.d.ts | 69 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6251 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 26c6139..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d42f449..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index 5b34124..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 841424111dcae1456f27d0a810be28d9e7152891 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 23 Nov 2023 01:17:45 +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 | 47 +- benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 41 files changed, 6206 insertions(+), 3961 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index 13f2075..1dddf05 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d42f449 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..298ae82 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 8c36ae8dea6c9c1fa8a837e93db80f73125e6390 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 08:46:00 +0000 Subject: [PATCH 21/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6252 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 1dddf05..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d42f449..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index 298ae82..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c090c8fb2b100bcdf8b7d750be5bd42ccf060077 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 08:48:54 +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 | 47 +- benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 42 files changed, 6206 insertions(+), 3957 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index 13f2075..1dddf05 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d42f449 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ad5f151 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 f0569047170908933773fab47c4c38ef5b7ac466 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 13:36:52 +0000 Subject: [PATCH 24/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6252 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 1dddf05..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d42f449..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index ad5f151..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 58c0910b540789385b6cbef225c52f6cc1ca35f1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 13:37:11 +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 | 47 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 6206 insertions(+), 3963 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index 13f2075..1dddf05 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..e216335 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 18d948c4da60768802549cd35aefd78737564aa2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:20:55 +0000 Subject: [PATCH 27/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6252 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 1dddf05..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index e216335..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 69c51e4ecf2a793eeb0ea86dfddcb30b97b34432 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:21:19 +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 | 47 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 42 files changed, 6206 insertions(+), 3962 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -159,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..6410725 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 8daebb4933d0be1e8198ceffa942f87d537a3694 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 12:55:10 +0000 Subject: [PATCH 30/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6252 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index 6410725..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7aae715b6efbfafb7826ee668de49ff70ad56887 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 6206 insertions(+), 3968 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..6c68dc1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9d7b967 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 041705d6ec85efc9e317e0e38295af78824870ed Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 21:05:07 +0000 Subject: [PATCH 33/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6252 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index 9d7b967..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ac9ccdfb4d5b73ee992e36a3b86267c91cf1ba8c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 21:06:08 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 42 files changed, 6206 insertions(+), 3971 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..e098ce4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..1946901 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 781039cf81c9f60f35b022d53765ebe640ef133d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 22:10:32 +0000 Subject: [PATCH 35/76] Update README.md for ESM bundle v0.2.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 341424c..315875d 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ limitations under the License. ## Usage ```javascript -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.0-esm/index.mjs'; ``` #### mskbinary2d( arrays, shape, fcn ) @@ -107,7 +107,7 @@ var bernoulli = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-bern import filled2dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled2d-by@esm/index.mjs'; import zeros2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zeros2d@esm/index.mjs'; import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-ops-add@esm/index.mjs'; -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.0-esm/index.mjs'; var shape = [ 3, 3 ]; From 004395a1c0f9302307f7705e9692d5c64d494929 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 22:10:33 +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 315875d..3c3874f 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-mskbinary2d/tags). For example, + ```javascript import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.0-esm/index.mjs'; ``` @@ -107,7 +112,7 @@ var bernoulli = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-bern import filled2dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled2d-by@esm/index.mjs'; import zeros2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zeros2d@esm/index.mjs'; import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-ops-add@esm/index.mjs'; -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.0-esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; var shape = [ 3, 3 ]; 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 9dfae621052c060554006561ad23a5d668da26b1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 05:42:57 +0000 Subject: [PATCH 38/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6252 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index 1946901..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6e87c7f929eed00acfbb1722bc163084feff9046 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 05:44:34 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 42 files changed, 4871 insertions(+), 3965 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..56a0115 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 62c87b728600da01db86d86b9fafdd176a5a89eb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 07:25:29 +0000 Subject: [PATCH 40/76] Update README.md for ESM bundle v0.2.1 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d17e8ee..7c3a338 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ limitations under the License. ## Usage ```javascript -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.1-esm/index.mjs'; ``` #### mskbinary2d( arrays, shape, fcn ) @@ -107,7 +107,7 @@ var bernoulli = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-bern import filled2dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled2d-by@esm/index.mjs'; import zeros2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zeros2d@esm/index.mjs'; import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-ops-add@esm/index.mjs'; -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.1-esm/index.mjs'; var shape = [ 3, 3 ]; From 14a93cbeef03ec87b4e357d4abb5718dda4e8eb4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 07:25:30 +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 7c3a338..f2bb6e1 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-mskbinary2d/tags). For example, + ```javascript import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.1-esm/index.mjs'; ``` @@ -107,7 +112,7 @@ var bernoulli = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-bern import filled2dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled2d-by@esm/index.mjs'; import zeros2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zeros2d@esm/index.mjs'; import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-ops-add@esm/index.mjs'; -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.1-esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; var shape = [ 3, 3 ]; 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 c8edfae3f2e2404ae9a00b1e4f851ffa5f51cb01 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 12:00:30 +0000 Subject: [PATCH 43/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 88201bc98091e4f36000b32c64709623730a04ba Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 12:00:46 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 4871 insertions(+), 3967 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..56a0115 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 b4115e92a1d1c4e6b8ea832048e6c19f9a4ec94f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 11:11:12 +0000 Subject: [PATCH 46/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c1ffd15ee9f9763e981c396d086a5d91e37c6f03 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 11:11:25 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 4871 insertions(+), 3970 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..56a0115 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 a87f5b1bd02e51636a18cd8ccb68f878bfd21ed0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 07:53:17 +0000 Subject: [PATCH 49/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 62d3ed37b0c98b1fc02b981dec0e9c43c06de043 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 07:53:34 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 42 files changed, 4871 insertions(+), 3971 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..56a0115 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 aa903eabdc3ef320d6ed62127fddfcb799c8dbb7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:33:56 +0000 Subject: [PATCH 52/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5e321290bb6717642a8408f1a608845b25c60cea Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:34:22 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 42 files changed, 4871 insertions(+), 4081 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..a60c6a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 cff3c37adf6bc2b0fb546c92a522af95baa54d0f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:42:12 +0000 Subject: [PATCH 54/76] Update README.md for ESM bundle v0.2.2 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 25ea2b8..fcde4d4 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ limitations under the License. ## Usage ```javascript -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.2-esm/index.mjs'; ``` #### mskbinary2d( arrays, shape, fcn ) @@ -107,7 +107,7 @@ var bernoulli = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-bern import filled2dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled2d-by@esm/index.mjs'; import zeros2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zeros2d@esm/index.mjs'; import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-ops-add@esm/index.mjs'; -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.2-esm/index.mjs'; var shape = [ 3, 3 ]; From f30bcff0e195af94f40bdc020a03deb08076248f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 21:42:13 +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 fcde4d4..aaeb2e5 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ limitations under the License. ## Usage +```javascript +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-base-mskbinary2d/tags). For example, + ```javascript import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.2-esm/index.mjs'; ``` @@ -107,7 +112,7 @@ var bernoulli = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-bern import filled2dBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-filled2d-by@esm/index.mjs'; import zeros2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zeros2d@esm/index.mjs'; import add from 'https://cdn.jsdelivr.net/gh/stdlib-js/math-base-ops-add@esm/index.mjs'; -import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@v0.2.2-esm/index.mjs'; +import mskbinary2d from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskbinary2d@esm/index.mjs'; var shape = [ 3, 3 ]; 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 3d47606ae8facaf4bbe26deff425c784d1c11351 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 11:32:26 +0000 Subject: [PATCH 57/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 10114df455f2c0320ee1722006523a9417719098 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 4871 insertions(+), 4058 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..a60c6a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 d42a28e0857c676c247a73919067be5c8b561af5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 4 Aug 2024 01:17:39 +0000 Subject: [PATCH 60/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ba0fcd7111a38a0a0b7a81fdfba406d42eb3e815 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 4 Aug 2024 01:17:58 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 4871 insertions(+), 4084 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..a60c6a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 fb5cf014586bdd3e11b3ee9f6f7ad4949688ce5c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 11:27:50 +0000 Subject: [PATCH 63/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 779196a977c7c5f59d2cab9a4233c88829123771 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 11:28:05 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 4871 insertions(+), 4084 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..a60c6a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 bb747ce8bd9ac98aa5f9a94e439529a4beaa6d3d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 12:05:32 +0000 Subject: [PATCH 66/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5755243ad84882df925ca408c2bdfbbe8e42f281 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 12:05:46 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 4871 insertions(+), 4084 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..a60c6a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 e0a565632badc59ca7dd7b44955663b4d2b89d86 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 11:18:05 +0000 Subject: [PATCH 69/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2559669be4cf0aea0162f007d570e61c9ec1c7b4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 11:18:19 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 4871 insertions(+), 4084 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -161,7 +152,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..a60c6a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 1034e954760b7590c0b2c9a7d95824d45c8b9918 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 25 Nov 2024 08:16:33 +0000 Subject: [PATCH 72/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 9ccdb34d1604139a01edaced98cec8d2393792b9 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 43 files changed, 4871 insertions(+), 4222 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -162,7 +153,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..a60c6a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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 c1e352bd0faa78958f53df5db03bf3cf0f683754 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 11:28:45 +0000 Subject: [PATCH 75/76] Remove files --- index.d.ts | 70 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4917 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index e704e38..0000000 --- a/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/index.mjs b/index.mjs deleted file mode 100644 index d565b11..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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.html b/stats.html deleted file mode 100644 index f1742e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1d844faa8c6cf82f5af08819f52d68514fcc9b8d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 11:28:58 +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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 121 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 35 - docs/types/test.ts | 100 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 53 - lib/main.js | 92 - package.json | 65 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 159 - 44 files changed, 4871 insertions(+), 4223 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 delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (96%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 + + ```
@@ -162,7 +153,7 @@ console.log( z ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.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/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/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/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index fed145e..e704e38 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Array2D } from '@stdlib/types/array'; import { Shape2D } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d565b11 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +function f(f,o,r){var a,t,e,i,n,u,c,d,l,p,s,v;if(a=o[1],t=o[0],!(a<=0||t<=0))for(l=f[0],p=f[1],s=f[3],v=f[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* 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":["mskbinary2d","arrays","shape","fcn","S0","S1","i0","i1","x0","y0","z0","m0","x","y","z","m"],"mappings":";;AAoDA,SAASA,EAAaC,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..a60c6a5 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,41 +13,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 +34,8 @@ "missing values", "na" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f1742e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.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' ); - } -});