From a90701d7ebf8a57af905f883fce52161474cc437 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jan 2024 22:09:28 +0000 Subject: [PATCH 01/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6fafb02..ad2310d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-resolve-getter": "^0.1.0", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-zero-to": "^0.1.0", @@ -86,4 +87,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 97a2a776fc1fd1af022814c06a5e6a3ec552d06c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jan 2024 22:10:45 +0000 Subject: [PATCH 02/46] 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 | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 30 - docs/types/test.ts | 57 - examples/index.js | 38 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 43 - lib/main.js | 65 - package.json | 62 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 100 - 43 files changed, 6201 insertions(+), 3841 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 benchmark/benchmark.length.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 (92%) 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 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 68aba84..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: '43 19 * * 6' - - # 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 + + ```
@@ -137,7 +128,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index fedc44c..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var o=n(function(p,a){ -var v=require('@stdlib/array-base-resolve-getter/dist');function c(e,r){var s,u,i,t;for(s=v(e),u=v(r),i=[],t=0;t var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 57b35cc..0000000 --- a/examples/index.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); - -// Filter an array using the mask: -var y = mskreject( x, mask ); - -console.log( x ); -console.log( mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..be913fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.1.0-esm/index.mjs";function r(r,t){var s,n,a,o;for(s=e(r),n=e(t),a=[],o=0;o=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -87,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..85b0c58 --- /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 a849e49..0000000 --- a/test/test.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 1cd3621b323cfcd8282ff123584a1ae3864e43b2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 31 Jan 2024 02:42:24 +0000 Subject: [PATCH 03/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 502e877..5a17663 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-resolve-getter": "^0.1.0", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-zero-to": "^0.1.0", @@ -86,4 +87,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c04f028602fea2fe1e802ab9e18aacbece847df8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 31 Jan 2024 02:43:03 +0000 Subject: [PATCH 04/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6225 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index be913fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.1.0-esm/index.mjs";function r(r,t){var s,n,a,o;for(s=e(r),n=e(t),a=[],o=0;o - - - - - - Rollup Visualizer - - - -
- - - - - From 7cf18cd04cb79b9a3c9018c4a5d9eab1d883d51e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 31 Jan 2024 02:43:30 +0000 Subject: [PATCH 05/46] 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 | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 30 - docs/types/test.ts | 57 - examples/index.js | 38 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 43 - lib/main.js | 65 - package.json | 62 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 100 - 43 files changed, 6201 insertions(+), 3841 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 benchmark/benchmark.length.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 (92%) 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 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 68aba84..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: '43 19 * * 6' - - # 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 + + ```
@@ -137,7 +128,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index fedc44c..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var o=n(function(p,a){ -var v=require('@stdlib/array-base-resolve-getter/dist');function c(e,r){var s,u,i,t;for(s=v(e),u=v(r),i=[],t=0;t var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 57b35cc..0000000 --- a/examples/index.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); - -// Filter an array using the mask: -var y = mskreject( x, mask ); - -console.log( x ); -console.log( mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..be913fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.1.0-esm/index.mjs";function r(r,t){var s,n,a,o;for(s=e(r),n=e(t),a=[],o=0;o=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -87,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..95b9311 --- /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 a849e49..0000000 --- a/test/test.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 18e3e851b35e7727577aad7d03b017d80b684fe0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 31 Jan 2024 02:43:57 +0000 Subject: [PATCH 06/46] 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 55b8dde..3e327cf 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ limitations under the License. ## Usage ```javascript -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.1.0-esm/index.mjs'; ``` #### mskreject( x, mask ) @@ -85,7 +85,7 @@ var y = mskreject( x, [ 0, 1, 0, 1 ] ); import zeroTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zero-to@esm/index.mjs'; import bernoulli from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-bernoulli@esm/index.mjs'; -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.1.0-esm/index.mjs'; // Generate a linearly spaced array: var x = zeroTo( 20 ); From 2598a9f89b9eac03429410e18d7388a80c080c55 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 31 Jan 2024 02:43:58 +0000 Subject: [PATCH 07/46] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e327cf..173b8eb 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ limitations under the License. ## Usage +```javascript +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@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-mskreject/tags). For example, + ```javascript import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.1.0-esm/index.mjs'; ``` @@ -85,7 +90,7 @@ var y = mskreject( x, [ 0, 1, 0, 1 ] ); import zeroTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zero-to@esm/index.mjs'; import bernoulli from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-bernoulli@esm/index.mjs'; -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.1.0-esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; // Generate a linearly spaced array: var x = zeroTo( 20 ); From e70126a37b82d3f41995d1b710ea05f4552aef0b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 08:55:49 +0000 Subject: [PATCH 08/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 502e877..5a17663 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-resolve-getter": "^0.1.0", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-base-zero-to": "^0.1.0", @@ -86,4 +87,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 19f299a6fa3760e5acf78f5603623fd79729b32e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 14:19:43 +0000 Subject: [PATCH 09/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6225 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index be913fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.1.0-esm/index.mjs";function r(r,t){var s,n,a,o;for(s=e(r),n=e(t),a=[],o=0;o - - - - - - Rollup Visualizer - - - -
- - - - - From b36f4319c18e14b41ca7cc1dcbb402f19cac9f8e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 14:20:11 +0000 Subject: [PATCH 10/46] 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 | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 30 - docs/types/test.ts | 57 - examples/index.js | 38 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 43 - lib/main.js | 65 - package.json | 62 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 100 - 44 files changed, 6201 insertions(+), 3842 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 benchmark/benchmark.length.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 (92%) 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 55684c9..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T06:15:25.295Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 68aba84..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: '43 19 * * 6' - - # 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 + + ```
@@ -137,7 +128,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index fedc44c..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var o=n(function(p,a){ -var v=require('@stdlib/array-base-resolve-getter/dist');function c(e,r){var s,u,i,t;for(s=v(e),u=v(r),i=[],t=0;t var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 57b35cc..0000000 --- a/examples/index.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); - -// Filter an array using the mask: -var y = mskreject( x, mask ); - -console.log( x ); -console.log( mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..be913fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.1.0-esm/index.mjs";function r(r,t){var s,n,a,o;for(s=e(r),n=e(t),a=[],o=0;o=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -87,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9708e23 --- /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 a849e49..0000000 --- a/test/test.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 8df4984c727f6b44b984c8de89f5b9ebbb705347 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 01:00:40 +0000 Subject: [PATCH 11/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8b8fdaf..fc06c4d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/array-base-resolve-getter": "^0.2.0", - "@stdlib/types": "^0.3.1" + "@stdlib/types": "^0.3.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/array-base-zero-to": "^0.1.0", @@ -86,4 +87,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From dfe256bc4a304014ec78eebb5820ef17be163d9b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:32:32 +0000 Subject: [PATCH 12/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6225 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index be913fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.1.0-esm/index.mjs";function r(r,t){var s,n,a,o;for(s=e(r),n=e(t),a=[],o=0;o - - - - - - Rollup Visualizer - - - -
- - - - - From 150c2fbc9a769b1babcd5c79d97d3da6feb476ff Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:33:31 +0000 Subject: [PATCH 13/46] 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 | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 30 - docs/types/test.ts | 57 - examples/index.js | 38 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 43 - lib/main.js | 65 - package.json | 62 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 100 - 43 files changed, 6201 insertions(+), 3845 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 benchmark/benchmark.length.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 (92%) 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 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 723dabb..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: '43 19 * * 6' - - # 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 + + ```
@@ -137,7 +128,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index fedc44c..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var n=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var o=n(function(p,a){ -var v=require('@stdlib/array-base-resolve-getter/dist');function c(e,r){var s,u,i,t;for(s=v(e),u=v(r),i=[],t=0;t var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 57b35cc..0000000 --- a/examples/index.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); - -// Filter an array using the mask: -var y = mskreject( x, mask ); - -console.log( x ); -console.log( mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..be913fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.1.0-esm/index.mjs";function r(r,t){var s,n,a,o;for(s=e(r),n=e(t),a=[],o=0;o=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -87,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..8f3bbe2 --- /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 a849e49..0000000 --- a/test/test.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 5e3085bb9a731bd7a5851c8cdc55a8e021b7ebf5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 06:29:40 +0000 Subject: [PATCH 14/46] 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 593a102..a92b564 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ limitations under the License. ## Usage ```javascript -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.0-esm/index.mjs'; ``` #### mskreject( x, mask ) @@ -85,7 +85,7 @@ var y = mskreject( x, [ 0, 1, 0, 1 ] ); import zeroTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zero-to@esm/index.mjs'; import bernoulli from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-bernoulli@esm/index.mjs'; -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.0-esm/index.mjs'; // Generate a linearly spaced array: var x = zeroTo( 20 ); From 5f31da6b4423ff0a3d1f52f26a82f76953b3aea7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 06:29:41 +0000 Subject: [PATCH 15/46] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a92b564..917f1d3 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ limitations under the License. ## Usage +```javascript +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@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-mskreject/tags). For example, + ```javascript import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.0-esm/index.mjs'; ``` @@ -85,7 +90,7 @@ var y = mskreject( x, [ 0, 1, 0, 1 ] ); import zeroTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zero-to@esm/index.mjs'; import bernoulli from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-bernoulli@esm/index.mjs'; -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.0-esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; // Generate a linearly spaced array: var x = zeroTo( 20 ); From 17a3d338cd1e63b9cf855aa16b79fc8978406769 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 20 Feb 2024 03:58:06 +0000 Subject: [PATCH 16/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index de346b3..248952c 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/array-base-resolve-getter": "^0.2.0", "@stdlib/strided-base-reinterpret-complex": "github:stdlib-js/strided-base-reinterpret-complex#main", "@stdlib/types": "^0.3.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.0", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 11e863ff324c72584f21567b7245c35f65e8b8a6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 20 Feb 2024 03:58:33 +0000 Subject: [PATCH 17/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6225 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index be913fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.1.0-esm/index.mjs";function r(r,t){var s,n,a,o;for(s=e(r),n=e(t),a=[],o=0;o - - - - - - Rollup Visualizer - - - -
- - - - - From 6bc9b273007797288bf190820a744b3852eb531f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 20 Feb 2024 04:01:05 +0000 Subject: [PATCH 18/46] 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 | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 221 - lib/index.js | 63 - lib/main.js | 65 - package.json | 73 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 289 -- test/test.js | 41 - test/test.main.js | 100 - 47 files changed, 4872 insertions(+), 4567 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a1d624f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var f=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var m=f(function(z,q){ -var p=require('@stdlib/array-base-resolve-getter/dist');function b(a,t){var e,v,i,r;for(e=p(a),v=p(t),i=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAyBtE,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACAC,EAGJ,IADAD,EAAKD,EACCE,EAAI,EAAGA,EAAIN,EAAE,OAAQM,IACpBL,EAAMK,CAAE,IACbJ,EAAKG,CAAG,EAAIL,EAAGM,CAAE,EACjBD,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASK,EAAWP,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAII,EACAC,EACAC,EACAC,EACAC,EACAC,EACAR,EACAC,EAWJ,IATAE,EAAQR,EAAE,KACVS,EAAQR,EAAK,KACbS,EAAQR,EAAI,KAEZS,EAAOX,EAAE,UAAW,CAAE,EACtBY,EAAOX,EAAK,UAAW,CAAE,EACzBY,EAAOX,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCE,EAAI,EAAGA,EAAIE,EAAM,OAAQF,IACxBM,EAAMH,EAAOH,CAAE,IACpBO,EAAMH,EAAOL,EAAIM,EAAMH,EAAOF,CAAE,CAAE,EAClCD,GAAMF,GAGR,OAAOO,CACR,CAyBA,SAASI,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIK,EACAG,EACAP,EACAU,EACAT,EACAU,EAOJ,IALAP,EAAQR,EAAK,KACbW,EAAOX,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRE,EAAI,EAAGA,EAAIG,EAAM,OAAQH,IACxBM,EAAMH,EAAOH,CAAE,IACpBU,EAAIV,EAAI,EACRJ,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CA0BA,SAASe,EAAQjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIc,EACAC,EACAC,EAKJ,OAHAF,EAAKrB,EAAkBG,CAAE,EACzBmB,EAAKtB,EAAkBI,CAAK,EAC5BmB,EAAKvB,EAAkBK,CAAI,EAE1BgB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIFxB,EAAmBsB,EAAG,KAAM,GAC5BtB,EAAmBwB,EAAG,KAAM,GAE5BN,EAAShB,EAAaE,EAAG,CAAE,EAAGmB,EAAIrB,EAAaI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,IAERK,EAAWW,EAAIC,EAAIC,EAAIjB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAP,EAAO,QAAUsB,IC1KjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "arraylike2object", "reinterpret", "indexed", "x", "mask", "out", "stride", "offset", "io", "i", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "complex", "so", "j", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..7873171 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.0-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@esm/index.mjs";function a(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;siBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CCkIA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QAhEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CA4CGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,IAtHV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAIgB,EACAR,EACAS,EACA1B,EACAC,EACA0B,EACAT,EACAf,EAWJ,IATAsB,EAAQ3B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbK,EAAQxB,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBK,EAAOzB,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIsB,EAAMpB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBwB,EAAMD,EAAOR,EAAIlB,EAAMyB,EAAOtB,IAC9Be,GAAMV,EAIT,CA8FEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAlKT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAwJCoB,CAAS9B,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CC9JA2B,EAAAC,EAAA,SAAAvB"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 518961a..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,221 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index 248952c..66cb1f9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.0", "description": "Apply a mask to a provided input 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,50 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.0", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.0", - "@stdlib/array-base-resolve-getter": "^0.2.0", - "@stdlib/strided-base-reinterpret-complex": "github:stdlib-js/strided-base-reinterpret-complex#main", - "@stdlib/types": "^0.3.1", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.0", - "@stdlib/array-base-zero-to": "^0.2.0", - "@stdlib/array-base-zeros": "^0.2.0", - "@stdlib/array-complex64": "^0.2.0", - "@stdlib/array-int32": "^0.2.0", - "@stdlib/array-zeros": "^0.2.0", - "@stdlib/assert-has-own-property": "^0.2.0", - "@stdlib/assert-is-array": "^0.2.0", - "@stdlib/assert-is-method": "^0.2.0", - "@stdlib/assert-is-nan": "^0.2.0", - "@stdlib/assert-is-same-complex64": "^0.2.0", - "@stdlib/assert-is-same-complex64array": "^0.2.0", - "@stdlib/math-base-special-pow": "^0.2.0", - "@stdlib/random-array-bernoulli": "^0.2.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "utilities", @@ -98,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..0050be3 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index e5f4c3a..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,289 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index a849e49..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 99a3931e3a0ecda1086524dbac4206d4ba535dd8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 20:59:02 +0000 Subject: [PATCH 19/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7123871..0cde4fa 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/array-base-resolve-getter": "^0.2.0", "@stdlib/strided-base-reinterpret-complex": "^0.1.1", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.0", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 816b17c3326b1809cfccded69d9860d4b5328e4a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 22:16:52 +0000 Subject: [PATCH 20/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4890 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7873171..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.0-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@esm/index.mjs";function a(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;siBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CCkIA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QAhEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CA4CGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,IAtHV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAIgB,EACAR,EACAS,EACA1B,EACAC,EACA0B,EACAT,EACAf,EAWJ,IATAsB,EAAQ3B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbK,EAAQxB,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBK,EAAOzB,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIsB,EAAMpB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBwB,EAAMD,EAAOR,EAAIlB,EAAMyB,EAAOtB,IAC9Be,GAAMV,EAIT,CA8FEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAlKT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAwJCoB,CAAS9B,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CC9JA2B,EAAAC,EAAA,SAAAvB"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 0050be3..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5d6d3dae51b2fdba15d3068cbd252d213dfcd76f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 22:17:22 +0000 Subject: [PATCH 21/46] 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 | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 221 - lib/index.js | 63 - lib/main.js | 65 - package.json | 73 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 289 -- test/test.js | 41 - test/test.main.js | 100 - 47 files changed, 4872 insertions(+), 4567 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a1d624f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var f=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var m=f(function(z,q){ -var p=require('@stdlib/array-base-resolve-getter/dist');function b(a,t){var e,v,i,r;for(e=p(a),v=p(t),i=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAyBtE,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACAC,EAGJ,IADAD,EAAKD,EACCE,EAAI,EAAGA,EAAIN,EAAE,OAAQM,IACpBL,EAAMK,CAAE,IACbJ,EAAKG,CAAG,EAAIL,EAAGM,CAAE,EACjBD,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASK,EAAWP,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAII,EACAC,EACAC,EACAC,EACAC,EACAC,EACAR,EACAC,EAWJ,IATAE,EAAQR,EAAE,KACVS,EAAQR,EAAK,KACbS,EAAQR,EAAI,KAEZS,EAAOX,EAAE,UAAW,CAAE,EACtBY,EAAOX,EAAK,UAAW,CAAE,EACzBY,EAAOX,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCE,EAAI,EAAGA,EAAIE,EAAM,OAAQF,IACxBM,EAAMH,EAAOH,CAAE,IACpBO,EAAMH,EAAOL,EAAIM,EAAMH,EAAOF,CAAE,CAAE,EAClCD,GAAMF,GAGR,OAAOO,CACR,CAyBA,SAASI,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIK,EACAG,EACAP,EACAU,EACAT,EACAU,EAOJ,IALAP,EAAQR,EAAK,KACbW,EAAOX,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRE,EAAI,EAAGA,EAAIG,EAAM,OAAQH,IACxBM,EAAMH,EAAOH,CAAE,IACpBU,EAAIV,EAAI,EACRJ,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CA0BA,SAASe,EAAQjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIc,EACAC,EACAC,EAKJ,OAHAF,EAAKrB,EAAkBG,CAAE,EACzBmB,EAAKtB,EAAkBI,CAAK,EAC5BmB,EAAKvB,EAAkBK,CAAI,EAE1BgB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIFxB,EAAmBsB,EAAG,KAAM,GAC5BtB,EAAmBwB,EAAG,KAAM,GAE5BN,EAAShB,EAAaE,EAAG,CAAE,EAAGmB,EAAIrB,EAAaI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,IAERK,EAAWW,EAAIC,EAAIC,EAAIjB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAP,EAAO,QAAUsB,IC1KjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "arraylike2object", "reinterpret", "indexed", "x", "mask", "out", "stride", "offset", "io", "i", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "complex", "so", "j", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a4c1b08 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.1-esm/index.mjs";function a(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;6iBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CCkIA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QAhEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CA4CGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,IAtHV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAIgB,EACAR,EACAS,EACA1B,EACAC,EACA0B,EACAT,EACAf,EAWJ,IATAsB,EAAQ3B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbK,EAAQxB,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBK,EAAOzB,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIsB,EAAMpB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBwB,EAAMD,EAAOR,EAAIlB,EAAMyB,EAAOtB,IAC9Be,GAAMV,EAIT,CA8FEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAlKT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAwJCoB,CAAS9B,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CC9JA2B,EAAAC,EAAA,SAAAvB"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 518961a..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,221 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index 0cde4fa..d10d7d0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Apply a mask to a provided input 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,50 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1", - "@stdlib/array-base-resolve-getter": "^0.2.0", - "@stdlib/strided-base-reinterpret-complex": "^0.1.1", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.0", - "@stdlib/array-base-zero-to": "^0.2.0", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-complex64": "^0.2.0", - "@stdlib/array-int32": "^0.2.1", - "@stdlib/array-zeros": "^0.2.0", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-method": "^0.2.1", - "@stdlib/assert-is-nan": "^0.2.1", - "@stdlib/assert-is-same-complex64": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.0", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-array-bernoulli": "^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", "utilities", @@ -98,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..775a9d5 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index e5f4c3a..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,289 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index a849e49..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 7103b381237ea7637d7eae3d678ab56f46a00f25 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 22:33:21 +0000 Subject: [PATCH 22/46] Update README.md for ESM bundle v0.2.1 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7e3d887..b313123 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,13 @@ limitations under the License. ## Usage ```javascript -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.1-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.1-esm/index.mjs'; ``` #### mskreject( x, mask ) @@ -122,7 +122,7 @@ The function supports the following parameters: import zeroTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zero-to@esm/index.mjs'; import bernoulli from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-bernoulli@esm/index.mjs'; -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.1-esm/index.mjs'; // Generate a linearly spaced array: var x = zeroTo( 20 ); From d95a1b4fd875b36aaaa68f5be418a4af83fd238a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 22:33:22 +0000 Subject: [PATCH 23/46] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b313123..d703391 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ limitations under the License. ## Usage +```javascript +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@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-mskreject/tags). For example, + ```javascript import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.1-esm/index.mjs'; ``` @@ -48,7 +53,7 @@ import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskrejec You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.1-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; ``` #### mskreject( x, mask ) @@ -122,7 +127,7 @@ The function supports the following parameters: import zeroTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zero-to@esm/index.mjs'; import bernoulli from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-bernoulli@esm/index.mjs'; -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.2.1-esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; // Generate a linearly spaced array: var x = zeroTo( 20 ); From 92782058733c6945f5d2797dd717c3bfd5c93047 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 08:35:36 +0000 Subject: [PATCH 24/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7b99745..c1e1951 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/array-base-resolve-getter": "^0.2.1", "@stdlib/strided-base-reinterpret-complex": "^0.1.1", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.1", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 4b5d334860336a3d07847e615b5091996e161c6d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 14:10:43 +0000 Subject: [PATCH 25/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4890 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a4c1b08..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.1-esm/index.mjs";function a(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;6iBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CCkIA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QAhEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CA4CGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,IAtHV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAIgB,EACAR,EACAS,EACA1B,EACAC,EACA0B,EACAT,EACAf,EAWJ,IATAsB,EAAQ3B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbK,EAAQxB,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBK,EAAOzB,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIsB,EAAMpB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBwB,EAAMD,EAAOR,EAAIlB,EAAMyB,EAAOtB,IAC9Be,GAAMV,EAIT,CA8FEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAlKT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAwJCoB,CAAS9B,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CC9JA2B,EAAAC,EAAA,SAAAvB"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 775a9d5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 954d2a9071f92a40facfc93b56294edbb44aa77c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 14:11:01 +0000 Subject: [PATCH 26/46] 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 | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 221 - lib/index.js | 63 - lib/main.js | 65 - package.json | 73 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 289 -- test/test.js | 41 - test/test.main.js | 100 - 48 files changed, 4872 insertions(+), 4572 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index cd7c25b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T05:53:40.856Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a1d624f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var f=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var m=f(function(z,q){ -var p=require('@stdlib/array-base-resolve-getter/dist');function b(a,t){var e,v,i,r;for(e=p(a),v=p(t),i=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAyBtE,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACAC,EAGJ,IADAD,EAAKD,EACCE,EAAI,EAAGA,EAAIN,EAAE,OAAQM,IACpBL,EAAMK,CAAE,IACbJ,EAAKG,CAAG,EAAIL,EAAGM,CAAE,EACjBD,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASK,EAAWP,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAII,EACAC,EACAC,EACAC,EACAC,EACAC,EACAR,EACAC,EAWJ,IATAE,EAAQR,EAAE,KACVS,EAAQR,EAAK,KACbS,EAAQR,EAAI,KAEZS,EAAOX,EAAE,UAAW,CAAE,EACtBY,EAAOX,EAAK,UAAW,CAAE,EACzBY,EAAOX,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCE,EAAI,EAAGA,EAAIE,EAAM,OAAQF,IACxBM,EAAMH,EAAOH,CAAE,IACpBO,EAAMH,EAAOL,EAAIM,EAAMH,EAAOF,CAAE,CAAE,EAClCD,GAAMF,GAGR,OAAOO,CACR,CAyBA,SAASI,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIK,EACAG,EACAP,EACAU,EACAT,EACAU,EAOJ,IALAP,EAAQR,EAAK,KACbW,EAAOX,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRE,EAAI,EAAGA,EAAIG,EAAM,OAAQH,IACxBM,EAAMH,EAAOH,CAAE,IACpBU,EAAIV,EAAI,EACRJ,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CA0BA,SAASe,EAAQjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIc,EACAC,EACAC,EAKJ,OAHAF,EAAKrB,EAAkBG,CAAE,EACzBmB,EAAKtB,EAAkBI,CAAK,EAC5BmB,EAAKvB,EAAkBK,CAAI,EAE1BgB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIFxB,EAAmBsB,EAAG,KAAM,GAC5BtB,EAAmBwB,EAAG,KAAM,GAE5BN,EAAShB,EAAaE,EAAG,CAAE,EAAGmB,EAAIrB,EAAaI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,IAERK,EAAWW,EAAIC,EAAIC,EAAIjB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAP,EAAO,QAAUsB,IC1KjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "arraylike2object", "reinterpret", "indexed", "x", "mask", "out", "stride", "offset", "io", "i", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "complex", "so", "j", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a4c1b08 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.1-esm/index.mjs";function a(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;6iBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CCkIA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QAhEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CA4CGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,IAtHV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAIgB,EACAR,EACAS,EACA1B,EACAC,EACA0B,EACAT,EACAf,EAWJ,IATAsB,EAAQ3B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbK,EAAQxB,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBK,EAAOzB,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIsB,EAAMpB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBwB,EAAMD,EAAOR,EAAIlB,EAAMyB,EAAOtB,IAC9Be,GAAMV,EAIT,CA8FEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAlKT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAwJCoB,CAAS9B,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CC9JA2B,EAAAC,EAAA,SAAAvB"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 518961a..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,221 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index c1e1951..d10d7d0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Apply a mask to a provided input 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,50 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1", - "@stdlib/array-base-resolve-getter": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex": "^0.1.1", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zero-to": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-int32": "^0.2.1", - "@stdlib/array-zeros": "^0.2.1", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-method": "^0.2.1", - "@stdlib/assert-is-nan": "^0.2.1", - "@stdlib/assert-is-same-complex64": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-array-bernoulli": "^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", "utilities", @@ -98,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..775a9d5 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index e5f4c3a..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,289 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index a849e49..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 1ac642aba6463c91744aebd505b1a4a63ff67cb7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 04:38:48 +0000 Subject: [PATCH 27/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7b99745..c1e1951 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/array-base-resolve-getter": "^0.2.1", "@stdlib/strided-base-reinterpret-complex": "^0.1.1", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.1", @@ -97,4 +98,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ca2abaa345ef21885d5cbdd8f9a936a67e756899 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 10:23:56 +0000 Subject: [PATCH 28/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4890 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a4c1b08..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.1-esm/index.mjs";function a(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;6iBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CCkIA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QAhEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CA4CGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,IAtHV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAIgB,EACAR,EACAS,EACA1B,EACAC,EACA0B,EACAT,EACAf,EAWJ,IATAsB,EAAQ3B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbK,EAAQxB,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBK,EAAOzB,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIsB,EAAMpB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBwB,EAAMD,EAAOR,EAAIlB,EAAMyB,EAAOtB,IAC9Be,GAAMV,EAIT,CA8FEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAlKT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAwJCoB,CAAS9B,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CC9JA2B,EAAAC,EAAA,SAAAvB"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 775a9d5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6117a7cf9f114d42fcfcbcf82bfe110d26f39402 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 10:24:29 +0000 Subject: [PATCH 29/46] 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 | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 221 - lib/index.js | 63 - lib/main.js | 65 - package.json | 73 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 289 -- test/test.js | 41 - test/test.main.js | 100 - 47 files changed, 4872 insertions(+), 4573 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a1d624f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var f=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var m=f(function(z,q){ -var p=require('@stdlib/array-base-resolve-getter/dist');function b(a,t){var e,v,i,r;for(e=p(a),v=p(t),i=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAyBtE,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACAC,EAGJ,IADAD,EAAKD,EACCE,EAAI,EAAGA,EAAIN,EAAE,OAAQM,IACpBL,EAAMK,CAAE,IACbJ,EAAKG,CAAG,EAAIL,EAAGM,CAAE,EACjBD,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASK,EAAWP,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAII,EACAC,EACAC,EACAC,EACAC,EACAC,EACAR,EACAC,EAWJ,IATAE,EAAQR,EAAE,KACVS,EAAQR,EAAK,KACbS,EAAQR,EAAI,KAEZS,EAAOX,EAAE,UAAW,CAAE,EACtBY,EAAOX,EAAK,UAAW,CAAE,EACzBY,EAAOX,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCE,EAAI,EAAGA,EAAIE,EAAM,OAAQF,IACxBM,EAAMH,EAAOH,CAAE,IACpBO,EAAMH,EAAOL,EAAIM,EAAMH,EAAOF,CAAE,CAAE,EAClCD,GAAMF,GAGR,OAAOO,CACR,CAyBA,SAASI,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIK,EACAG,EACAP,EACAU,EACAT,EACAU,EAOJ,IALAP,EAAQR,EAAK,KACbW,EAAOX,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRE,EAAI,EAAGA,EAAIG,EAAM,OAAQH,IACxBM,EAAMH,EAAOH,CAAE,IACpBU,EAAIV,EAAI,EACRJ,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CA0BA,SAASe,EAAQjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIc,EACAC,EACAC,EAKJ,OAHAF,EAAKrB,EAAkBG,CAAE,EACzBmB,EAAKtB,EAAkBI,CAAK,EAC5BmB,EAAKvB,EAAkBK,CAAI,EAE1BgB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIFxB,EAAmBsB,EAAG,KAAM,GAC5BtB,EAAmBwB,EAAG,KAAM,GAE5BN,EAAShB,EAAaE,EAAG,CAAE,EAAGmB,EAAIrB,EAAaI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,IAERK,EAAWW,EAAIC,EAAIC,EAAIjB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAP,EAAO,QAAUsB,IC1KjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "arraylike2object", "reinterpret", "indexed", "x", "mask", "out", "stride", "offset", "io", "i", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "complex", "so", "j", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a4c1b08 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.1-esm/index.mjs";function a(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;6iBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CCkIA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QAhEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CA4CGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,IAtHV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAIgB,EACAR,EACAS,EACA1B,EACAC,EACA0B,EACAT,EACAf,EAWJ,IATAsB,EAAQ3B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbK,EAAQxB,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBK,EAAOzB,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIsB,EAAMpB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBwB,EAAMD,EAAOR,EAAIlB,EAAMyB,EAAOtB,IAC9Be,GAAMV,EAIT,CA8FEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAlKT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAwJCoB,CAAS9B,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CC9JA2B,EAAAC,EAAA,SAAAvB"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 518961a..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,221 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index c1e1951..d10d7d0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Apply a mask to a provided input 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,50 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1", - "@stdlib/array-base-resolve-getter": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex": "^0.1.1", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zero-to": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-int32": "^0.2.1", - "@stdlib/array-zeros": "^0.2.1", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-method": "^0.2.1", - "@stdlib/assert-is-nan": "^0.2.1", - "@stdlib/assert-is-same-complex64": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-array-bernoulli": "^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", "utilities", @@ -98,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..775a9d5 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index e5f4c3a..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,289 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index a849e49..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 9c957588007c76aaa40b20661bf44c46477984f6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 25 Jun 2024 20:03:47 +0000 Subject: [PATCH 30/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ab90ec3..8d1295c 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "@stdlib/strided-base-reinterpret-boolean": "^0.0.1", "@stdlib/strided-base-reinterpret-complex": "^0.1.1", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.1", @@ -101,4 +102,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From a40da7830e13ef64fd3b4c3a7f1137ed34680b54 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 25 Jun 2024 20:04:40 +0000 Subject: [PATCH 31/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4890 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a4c1b08..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.1-esm/index.mjs";function a(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;6iBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CCkIA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QAhEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CA4CGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,IAtHV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAIgB,EACAR,EACAS,EACA1B,EACAC,EACA0B,EACAT,EACAf,EAWJ,IATAsB,EAAQ3B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbK,EAAQxB,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBK,EAAOzB,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIsB,EAAMpB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBwB,EAAMD,EAAOR,EAAIlB,EAAMyB,EAAOtB,IAC9Be,GAAMV,EAIT,CA8FEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAlKT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAwJCoB,CAAS9B,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CC9JA2B,EAAAC,EAAA,SAAAvB"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 775a9d5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From db10b6628a8be67c3f1ea0d2a6e003db5efa7590 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 25 Jun 2024 20:05:49 +0000 Subject: [PATCH 32/46] 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 | 95 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 272 -- lib/index.js | 63 - lib/main.js | 65 - package.json | 77 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 349 -- test/test.js | 41 - test/test.main.js | 113 - 47 files changed, 4872 insertions(+), 4802 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 f92a6c5..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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index c6e8afa..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var p=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var y=p(function(E,q){ -var f=require('@stdlib/array-base-resolve-getter/dist');function D(a,t){var e,v,n,r;for(e=f(a),v=f(t),n=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAoB,QAAS,gDAAiD,EAC9EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAClEC,EAAqB,QAAS,0CAA2C,EAyB7E,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACA,EAGJ,IADAA,EAAKD,EACC,EAAI,EAAG,EAAIJ,EAAE,OAAQ,IACpBC,EAAM,CAAE,IACbC,EAAKG,CAAG,EAAIL,EAAG,CAAE,EACjBK,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASI,EAAWN,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAIG,EACAC,EACAC,EACAC,EACAC,EACAC,EACAP,EACAQ,EAWJ,IATAN,EAAQP,EAAE,KACVQ,EAAQP,EAAK,KACbQ,EAAQP,EAAI,KAEZQ,EAAOV,EAAE,UAAW,CAAE,EACtBW,EAAOV,EAAK,UAAW,CAAE,EACzBW,EAAOV,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCS,EAAI,EAAGA,EAAIN,EAAM,OAAQM,IACxBF,EAAMH,EAAOK,CAAE,IACpBD,EAAMH,EAAOJ,EAAIK,EAAMH,EAAOM,CAAE,CAAE,EAClCR,GAAMF,GAGR,OAAOM,CACR,CAyBA,SAASK,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAU,EACAF,EACAG,EAOJ,IALAR,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBG,EAAIH,EAAI,EACRX,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CAyBA,SAASe,EAASjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAQ,EAMJ,IAJAL,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBI,EAAKD,EACCS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBX,EAAKG,CAAG,EAAIL,EAAGa,CAAE,EACjBR,GAAMF,GAGR,OAAOD,CACR,CA0BA,SAASgB,EAAQlB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIe,EACAC,EACAC,EAKJ,OAHAF,EAAKvB,EAAkBI,CAAE,EACzBoB,EAAKxB,EAAkBK,CAAK,EAC5BoB,EAAKzB,EAAkBM,CAAI,EAE1BiB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIF3B,EAAmByB,EAAG,KAAM,GAC5BzB,EAAmB2B,EAAG,KAAM,GAE5BP,EAASjB,EAAaG,EAAG,CAAE,EAAGoB,EAAIvB,EAAaK,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,GAGPP,EAAmBwB,EAAG,KAAM,GAC5BxB,EAAmB0B,EAAG,KAAM,GAE5BJ,EAASnB,EAAoBE,EAAG,CAAE,EAAGoB,EAAItB,EAAoBI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAC/EF,IAERI,EAAWa,EAAIC,EAAIC,EAAIlB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAT,EAAO,QAAUyB,IC7NjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "isBooleanDataType", "arraylike2object", "reinterpret", "reinterpretBoolean", "indexed", "x", "mask", "out", "stride", "offset", "io", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "i", "complex", "so", "j", "boolean", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..96eca7b --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.1-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 02c5f00..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,272 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - -/** -* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array. -* -* @private -* @param {Collection} x - boolean input array view -* @param {Object} mask - mask array object -* @param {Collection} out - boolean output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Uint8Array = require( '@stdlib/array-uint8' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Uint8Array( [ 1, 0, 0, 1 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Uint8Array( 4 ); -* -* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1, 0, 0, 0 ] -*/ -function boolean( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var i; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - io = offset; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - if ( - isBooleanDataType( xo.dtype ) && - isBooleanDataType( oo.dtype ) - ) { - boolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index 8d1295c..d10d7d0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Apply a mask to a provided input 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,54 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-boolean-data-type": "^0.0.1", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1", - "@stdlib/array-base-resolve-getter": "^0.2.1", - "@stdlib/strided-base-reinterpret-boolean": "^0.0.1", - "@stdlib/strided-base-reinterpret-complex": "^0.1.1", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zero-to": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.1", - "@stdlib/array-bool": "^0.0.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-int32": "^0.2.1", - "@stdlib/array-zeros": "^0.2.1", - "@stdlib/assert-has-own-property": "^0.2.1", - "@stdlib/assert-is-array": "^0.2.1", - "@stdlib/assert-is-method": "^0.2.1", - "@stdlib/assert-is-nan": "^0.2.1", - "@stdlib/assert-is-same-booleanarray": "github:stdlib-js/assert-is-same-booleanarray#main", - "@stdlib/assert-is-same-complex64": "^0.2.1", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-array-bernoulli": "^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", "utilities", @@ -102,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..95c261f --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index b7dbd54..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,349 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var isSameBooleanArray = require( '@stdlib/assert-is-same-booleanarray' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (boolean array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new BooleanArray( [ true, false, false, true ] ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 2 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = new BooleanArray( 0 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = new BooleanArray( 1 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true, false, false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new BooleanArray( [ false, true, false, false ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - x = new BooleanArray( [ true, false, false, true ] ); - out = new BooleanArray( [ false, false, false, false ] ); - expected = new BooleanArray( [ false, false, false, false ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 07a1eb5..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - - x = new BooleanArray( [ true, false, false, true ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } - - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 5bfdaef370a7905a09f160557b811b420aca6815 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 11:57:54 +0000 Subject: [PATCH 33/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ee08e8d..1a691cd 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "@stdlib/strided-base-reinterpret-boolean": "^0.0.2", "@stdlib/strided-base-reinterpret-complex": "^0.1.2", "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.1", @@ -101,4 +102,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From bc6c01edc262729e6f7598b4f651944c1a168a6c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 12:04:56 +0000 Subject: [PATCH 34/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4890 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 96eca7b..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.1-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 95c261f..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 36be753f33b2c9b2955aaf35c0c00e2738cbae2b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 12:05:17 +0000 Subject: [PATCH 35/46] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 147 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 272 -- lib/index.js | 63 - lib/main.js | 65 - package.json | 77 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 349 -- test/test.js | 41 - test/test.main.js | 113 - 47 files changed, 4872 insertions(+), 4856 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index c6e8afa..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var p=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var y=p(function(E,q){ -var f=require('@stdlib/array-base-resolve-getter/dist');function D(a,t){var e,v,n,r;for(e=f(a),v=f(t),n=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAoB,QAAS,gDAAiD,EAC9EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAClEC,EAAqB,QAAS,0CAA2C,EAyB7E,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACA,EAGJ,IADAA,EAAKD,EACC,EAAI,EAAG,EAAIJ,EAAE,OAAQ,IACpBC,EAAM,CAAE,IACbC,EAAKG,CAAG,EAAIL,EAAG,CAAE,EACjBK,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASI,EAAWN,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAIG,EACAC,EACAC,EACAC,EACAC,EACAC,EACAP,EACAQ,EAWJ,IATAN,EAAQP,EAAE,KACVQ,EAAQP,EAAK,KACbQ,EAAQP,EAAI,KAEZQ,EAAOV,EAAE,UAAW,CAAE,EACtBW,EAAOV,EAAK,UAAW,CAAE,EACzBW,EAAOV,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCS,EAAI,EAAGA,EAAIN,EAAM,OAAQM,IACxBF,EAAMH,EAAOK,CAAE,IACpBD,EAAMH,EAAOJ,EAAIK,EAAMH,EAAOM,CAAE,CAAE,EAClCR,GAAMF,GAGR,OAAOM,CACR,CAyBA,SAASK,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAU,EACAF,EACAG,EAOJ,IALAR,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBG,EAAIH,EAAI,EACRX,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CAyBA,SAASe,EAASjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAQ,EAMJ,IAJAL,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBI,EAAKD,EACCS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBX,EAAKG,CAAG,EAAIL,EAAGa,CAAE,EACjBR,GAAMF,GAGR,OAAOD,CACR,CA0BA,SAASgB,EAAQlB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIe,EACAC,EACAC,EAKJ,OAHAF,EAAKvB,EAAkBI,CAAE,EACzBoB,EAAKxB,EAAkBK,CAAK,EAC5BoB,EAAKzB,EAAkBM,CAAI,EAE1BiB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIF3B,EAAmByB,EAAG,KAAM,GAC5BzB,EAAmB2B,EAAG,KAAM,GAE5BP,EAASjB,EAAaG,EAAG,CAAE,EAAGoB,EAAIvB,EAAaK,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,GAGPP,EAAmBwB,EAAG,KAAM,GAC5BxB,EAAmB0B,EAAG,KAAM,GAE5BJ,EAASnB,EAAoBE,EAAG,CAAE,EAAGoB,EAAItB,EAAoBI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAC/EF,IAERI,EAAWa,EAAIC,EAAIC,EAAIlB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAT,EAAO,QAAUyB,IC7NjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "isBooleanDataType", "arraylike2object", "reinterpret", "reinterpretBoolean", "indexed", "x", "mask", "out", "stride", "offset", "io", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "i", "complex", "so", "j", "boolean", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index af46bf6..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..c91210a --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.2-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 02c5f00..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,272 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - -/** -* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array. -* -* @private -* @param {Collection} x - boolean input array view -* @param {Object} mask - mask array object -* @param {Collection} out - boolean output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Uint8Array = require( '@stdlib/array-uint8' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Uint8Array( [ 1, 0, 0, 1 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Uint8Array( 4 ); -* -* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1, 0, 0, 0 ] -*/ -function boolean( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var i; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - io = offset; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - if ( - isBooleanDataType( xo.dtype ) && - isBooleanDataType( oo.dtype ) - ) { - boolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index 1a691cd..6cc9697 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.3.0", "description": "Apply a mask to a provided input 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,54 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-boolean-data-type": "^0.0.1", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1", - "@stdlib/array-base-resolve-getter": "^0.2.2", - "@stdlib/strided-base-reinterpret-boolean": "^0.0.2", - "@stdlib/strided-base-reinterpret-complex": "^0.1.2", - "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.1", - "@stdlib/array-base-zero-to": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.2", - "@stdlib/array-bool": "^0.1.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-int32": "^0.2.2", - "@stdlib/array-zeros": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-nan": "^0.2.2", - "@stdlib/assert-is-same-booleanarray": "github:stdlib-js/assert-is-same-booleanarray#main", - "@stdlib/assert-is-same-complex64": "^0.2.2", - "@stdlib/assert-is-same-complex64array": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-array-bernoulli": "^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", "utilities", @@ -102,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..308a3e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index b7dbd54..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,349 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var isSameBooleanArray = require( '@stdlib/assert-is-same-booleanarray' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (boolean array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new BooleanArray( [ true, false, false, true ] ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 2 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = new BooleanArray( 0 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = new BooleanArray( 1 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true, false, false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new BooleanArray( [ false, true, false, false ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - x = new BooleanArray( [ true, false, false, true ] ); - out = new BooleanArray( [ false, false, false, false ] ); - expected = new BooleanArray( [ false, false, false, false ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 07a1eb5..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - - x = new BooleanArray( [ true, false, false, true ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } - - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From c4de81c7744ba35afa0da05fd7e4e52d7b8b82c8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 12:07:44 +0000 Subject: [PATCH 36/46] Update README.md for ESM bundle v0.3.0 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a625fab..a116cf4 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,13 @@ limitations under the License. ## Usage ```javascript -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.3.0-esm/index.mjs'; ``` You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.3.0-esm/index.mjs'; ``` #### mskreject( x, mask ) @@ -122,7 +122,7 @@ The function supports the following parameters: import zeroTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zero-to@esm/index.mjs'; import bernoulli from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-bernoulli@esm/index.mjs'; -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.3.0-esm/index.mjs'; // Generate a linearly spaced array: var x = zeroTo( 20 ); From 22aa6bec33b816afc1de248f4823964f16850299 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 12:07:45 +0000 Subject: [PATCH 37/46] Auto-generated commit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a116cf4..43eaa19 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ limitations under the License. ## Usage +```javascript +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@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-mskreject/tags). For example, + ```javascript import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.3.0-esm/index.mjs'; ``` @@ -48,7 +53,7 @@ import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskrejec You can also import the following named exports from the package: ```javascript -import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.3.0-esm/index.mjs'; +import { assign } from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; ``` #### mskreject( x, mask ) @@ -122,7 +127,7 @@ The function supports the following parameters: import zeroTo from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-zero-to@esm/index.mjs'; import bernoulli from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-bernoulli@esm/index.mjs'; -import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@v0.3.0-esm/index.mjs'; +import mskreject from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-base-mskreject@esm/index.mjs'; // Generate a linearly spaced array: var x = zeroTo( 20 ); From a9afc01e457db166f79cb1eac21fa8cf82aee0a8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 11 Jan 2025 22:52:36 +0000 Subject: [PATCH 38/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3a82351..ad2cf8a 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "@stdlib/strided-base-reinterpret-boolean": "^0.0.2", "@stdlib/strided-base-reinterpret-complex": "^0.1.2", "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.2", @@ -101,4 +102,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f70f3e374a5a91a5a41f473440228cfa06659714 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 11 Jan 2025 22:55:18 +0000 Subject: [PATCH 39/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4890 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index c91210a..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.2-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 308a3e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 03944ef1cca9d3cb4533620b4e065ecea9f45bb2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 11 Jan 2025 22:55:34 +0000 Subject: [PATCH 40/46] 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 | 181 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 272 - lib/index.js | 63 - lib/main.js | 65 - package.json | 77 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 349 -- test/test.js | 41 - test/test.main.js | 113 - 48 files changed, 4872 insertions(+), 4995 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0779e8a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index c6e8afa..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var p=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var y=p(function(E,q){ -var f=require('@stdlib/array-base-resolve-getter/dist');function D(a,t){var e,v,n,r;for(e=f(a),v=f(t),n=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAoB,QAAS,gDAAiD,EAC9EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAClEC,EAAqB,QAAS,0CAA2C,EAyB7E,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACA,EAGJ,IADAA,EAAKD,EACC,EAAI,EAAG,EAAIJ,EAAE,OAAQ,IACpBC,EAAM,CAAE,IACbC,EAAKG,CAAG,EAAIL,EAAG,CAAE,EACjBK,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASI,EAAWN,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAIG,EACAC,EACAC,EACAC,EACAC,EACAC,EACAP,EACAQ,EAWJ,IATAN,EAAQP,EAAE,KACVQ,EAAQP,EAAK,KACbQ,EAAQP,EAAI,KAEZQ,EAAOV,EAAE,UAAW,CAAE,EACtBW,EAAOV,EAAK,UAAW,CAAE,EACzBW,EAAOV,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCS,EAAI,EAAGA,EAAIN,EAAM,OAAQM,IACxBF,EAAMH,EAAOK,CAAE,IACpBD,EAAMH,EAAOJ,EAAIK,EAAMH,EAAOM,CAAE,CAAE,EAClCR,GAAMF,GAGR,OAAOM,CACR,CAyBA,SAASK,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAU,EACAF,EACAG,EAOJ,IALAR,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBG,EAAIH,EAAI,EACRX,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CAyBA,SAASe,EAASjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAQ,EAMJ,IAJAL,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBI,EAAKD,EACCS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBX,EAAKG,CAAG,EAAIL,EAAGa,CAAE,EACjBR,GAAMF,GAGR,OAAOD,CACR,CA0BA,SAASgB,EAAQlB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIe,EACAC,EACAC,EAKJ,OAHAF,EAAKvB,EAAkBI,CAAE,EACzBoB,EAAKxB,EAAkBK,CAAK,EAC5BoB,EAAKzB,EAAkBM,CAAI,EAE1BiB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIF3B,EAAmByB,EAAG,KAAM,GAC5BzB,EAAmB2B,EAAG,KAAM,GAE5BP,EAASjB,EAAaG,EAAG,CAAE,EAAGoB,EAAIvB,EAAaK,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,GAGPP,EAAmBwB,EAAG,KAAM,GAC5BxB,EAAmB0B,EAAG,KAAM,GAE5BJ,EAASnB,EAAoBE,EAAG,CAAE,EAAGoB,EAAItB,EAAoBI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAC/EF,IAERI,EAAWa,EAAIC,EAAIC,EAAIlB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAT,EAAO,QAAUyB,IC7NjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "isBooleanDataType", "arraylike2object", "reinterpret", "reinterpretBoolean", "indexed", "x", "mask", "out", "stride", "offset", "io", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "i", "complex", "so", "j", "boolean", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index dc64981..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..89ef9d0 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.2-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 02c5f00..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,272 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - -/** -* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array. -* -* @private -* @param {Collection} x - boolean input array view -* @param {Object} mask - mask array object -* @param {Collection} out - boolean output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Uint8Array = require( '@stdlib/array-uint8' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Uint8Array( [ 1, 0, 0, 1 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Uint8Array( 4 ); -* -* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1, 0, 0, 0 ] -*/ -function boolean( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var i; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - io = offset; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - if ( - isBooleanDataType( xo.dtype ) && - isBooleanDataType( oo.dtype ) - ) { - boolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index ad2cf8a..6cc9697 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.3.0", "description": "Apply a mask to a provided input 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,54 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-boolean-data-type": "^0.0.1", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1", - "@stdlib/array-base-resolve-getter": "^0.2.2", - "@stdlib/strided-base-reinterpret-boolean": "^0.0.2", - "@stdlib/strided-base-reinterpret-complex": "^0.1.2", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.2", - "@stdlib/array-base-zero-to": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.2", - "@stdlib/array-bool": "^0.1.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-int32": "^0.2.2", - "@stdlib/array-zeros": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-nan": "^0.2.2", - "@stdlib/assert-is-same-booleanarray": "^0.1.0", - "@stdlib/assert-is-same-complex64": "^0.2.2", - "@stdlib/assert-is-same-complex64array": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-array-bernoulli": "^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", "utilities", @@ -102,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..308a3e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index b7dbd54..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,349 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var isSameBooleanArray = require( '@stdlib/assert-is-same-booleanarray' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (boolean array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new BooleanArray( [ true, false, false, true ] ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 2 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = new BooleanArray( 0 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = new BooleanArray( 1 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true, false, false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new BooleanArray( [ false, true, false, false ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - x = new BooleanArray( [ true, false, false, true ] ); - out = new BooleanArray( [ false, false, false, false ] ); - expected = new BooleanArray( [ false, false, false, false ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 07a1eb5..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - - x = new BooleanArray( [ true, false, false, true ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } - - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 8d929f07d787c3d9dce99997c75fa73aad99464c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 3 Feb 2025 00:53:12 +0000 Subject: [PATCH 41/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3a82351..ad2cf8a 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "@stdlib/strided-base-reinterpret-boolean": "^0.0.2", "@stdlib/strided-base-reinterpret-complex": "^0.1.2", "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.2", @@ -101,4 +102,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 6238a0f85ceb630d32137f3f483f66f48395a454 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 3 Feb 2025 01:14:46 +0000 Subject: [PATCH 42/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4890 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 89ef9d0..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.2-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 308a3e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d373de058ede61dfaf9afd8b0a1f8bdfd18c09e4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 3 Feb 2025 01:15:15 +0000 Subject: [PATCH 43/46] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 181 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 272 - lib/index.js | 63 - lib/main.js | 65 - package.json | 77 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 349 -- test/test.js | 41 - test/test.main.js | 113 - 49 files changed, 4872 insertions(+), 4995 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 7754c65..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-02-03T00:45:58.781Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 5a66c5d..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/mskreject) 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 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index c6e8afa..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var p=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var y=p(function(E,q){ -var f=require('@stdlib/array-base-resolve-getter/dist');function D(a,t){var e,v,n,r;for(e=f(a),v=f(t),n=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAoB,QAAS,gDAAiD,EAC9EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAClEC,EAAqB,QAAS,0CAA2C,EAyB7E,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACA,EAGJ,IADAA,EAAKD,EACC,EAAI,EAAG,EAAIJ,EAAE,OAAQ,IACpBC,EAAM,CAAE,IACbC,EAAKG,CAAG,EAAIL,EAAG,CAAE,EACjBK,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASI,EAAWN,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAIG,EACAC,EACAC,EACAC,EACAC,EACAC,EACAP,EACAQ,EAWJ,IATAN,EAAQP,EAAE,KACVQ,EAAQP,EAAK,KACbQ,EAAQP,EAAI,KAEZQ,EAAOV,EAAE,UAAW,CAAE,EACtBW,EAAOV,EAAK,UAAW,CAAE,EACzBW,EAAOV,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCS,EAAI,EAAGA,EAAIN,EAAM,OAAQM,IACxBF,EAAMH,EAAOK,CAAE,IACpBD,EAAMH,EAAOJ,EAAIK,EAAMH,EAAOM,CAAE,CAAE,EAClCR,GAAMF,GAGR,OAAOM,CACR,CAyBA,SAASK,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAU,EACAF,EACAG,EAOJ,IALAR,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBG,EAAIH,EAAI,EACRX,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CAyBA,SAASe,EAASjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAQ,EAMJ,IAJAL,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBI,EAAKD,EACCS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBX,EAAKG,CAAG,EAAIL,EAAGa,CAAE,EACjBR,GAAMF,GAGR,OAAOD,CACR,CA0BA,SAASgB,EAAQlB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIe,EACAC,EACAC,EAKJ,OAHAF,EAAKvB,EAAkBI,CAAE,EACzBoB,EAAKxB,EAAkBK,CAAK,EAC5BoB,EAAKzB,EAAkBM,CAAI,EAE1BiB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIF3B,EAAmByB,EAAG,KAAM,GAC5BzB,EAAmB2B,EAAG,KAAM,GAE5BP,EAASjB,EAAaG,EAAG,CAAE,EAAGoB,EAAIvB,EAAaK,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,GAGPP,EAAmBwB,EAAG,KAAM,GAC5BxB,EAAmB0B,EAAG,KAAM,GAE5BJ,EAASnB,EAAoBE,EAAG,CAAE,EAAGoB,EAAItB,EAAoBI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAC/EF,IAERI,EAAWa,EAAIC,EAAIC,EAAIlB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAT,EAAO,QAAUyB,IC7NjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "isBooleanDataType", "arraylike2object", "reinterpret", "reinterpretBoolean", "indexed", "x", "mask", "out", "stride", "offset", "io", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "i", "complex", "so", "j", "boolean", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index dc64981..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..89ef9d0 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.2-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 02c5f00..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,272 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - -/** -* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array. -* -* @private -* @param {Collection} x - boolean input array view -* @param {Object} mask - mask array object -* @param {Collection} out - boolean output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Uint8Array = require( '@stdlib/array-uint8' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Uint8Array( [ 1, 0, 0, 1 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Uint8Array( 4 ); -* -* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1, 0, 0, 0 ] -*/ -function boolean( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var i; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - io = offset; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - if ( - isBooleanDataType( xo.dtype ) && - isBooleanDataType( oo.dtype ) - ) { - boolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index ad2cf8a..6cc9697 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.3.0", "description": "Apply a mask to a provided input 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,54 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-boolean-data-type": "^0.0.1", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1", - "@stdlib/array-base-resolve-getter": "^0.2.2", - "@stdlib/strided-base-reinterpret-boolean": "^0.0.2", - "@stdlib/strided-base-reinterpret-complex": "^0.1.2", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.2", - "@stdlib/array-base-zero-to": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.2", - "@stdlib/array-bool": "^0.1.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-int32": "^0.2.2", - "@stdlib/array-zeros": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-nan": "^0.2.2", - "@stdlib/assert-is-same-booleanarray": "^0.1.0", - "@stdlib/assert-is-same-complex64": "^0.2.2", - "@stdlib/assert-is-same-complex64array": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-array-bernoulli": "^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", "utilities", @@ -102,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..308a3e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index b7dbd54..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,349 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var isSameBooleanArray = require( '@stdlib/assert-is-same-booleanarray' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (boolean array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new BooleanArray( [ true, false, false, true ] ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 2 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = new BooleanArray( 0 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = new BooleanArray( 1 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true, false, false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new BooleanArray( [ false, true, false, false ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - x = new BooleanArray( [ true, false, false, true ] ); - out = new BooleanArray( [ false, false, false, false ] ); - expected = new BooleanArray( [ false, false, false, false ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 07a1eb5..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - - x = new BooleanArray( [ true, false, false, true ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } - - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -}); From 1efa48947d53fdf780d2a27ba2ca1a3ae624748f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 19 May 2025 07:44:23 +0000 Subject: [PATCH 44/46] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f008a4d..e690ae8 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "@stdlib/strided-base-reinterpret-boolean": "^0.0.2", "@stdlib/strided-base-reinterpret-complex": "^0.1.2", "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2" + "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-base-to-accessor-array": "^0.2.2", @@ -101,4 +102,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 08d95bd952aeaa73c3185c517964df1beb6dbd19 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 19 May 2025 07:44:43 +0000 Subject: [PATCH 45/46] Remove files --- index.d.ts | 43 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4890 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 5a8a3d0..0000000 --- a/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { Collection } from '@stdlib/types/array'; - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param x - input array -* @param mask - mask array -* @returns output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* -* var y = mskreject( x, [ 0, 1, 0, 1 ] ); -* // returns [ 1, 3 ] -*/ -declare function mskreject( x: Collection, mask: Collection ): Array; - - -// EXPORTS // - -export = mskreject; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 89ef9d0..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.2-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 308a3e0..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 49ab708ebe27a5fa0cbb9d39cd28dbba12f2efd1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 19 May 2025 07:45:35 +0000 Subject: [PATCH 46/46] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 182 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 45 +- SECURITY.md | 5 - benchmark/benchmark.assign.length.js | 104 - benchmark/benchmark.js | 55 - benchmark/benchmark.length.js | 97 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 7 - dist/index.js.map | 7 - docs/repl.txt | 71 - docs/types/test.ts | 57 - examples/index.js | 37 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/assign.js | 272 - lib/index.js | 63 - lib/main.js | 65 - package.json | 77 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.assign.js | 349 -- test/test.js | 41 - test/test.main.js | 113 - 48 files changed, 4872 insertions(+), 4999 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.assign.length.js delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.length.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 (92%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/assign.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.assign.js delete mode 100644 test/test.js delete mode 100644 test/test.main.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 32087a4..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/mskreject) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 918e9ea..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/mskreject) 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 69d170f..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: '43 19 * * 6' - - # 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 + + ```
@@ -167,7 +164,7 @@ console.log( y ); ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.assign.length.js b/benchmark/benchmark.assign.length.js deleted file mode 100644 index b156a2a..0000000 --- a/benchmark/benchmark.assign.length.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var mask; - var out; - var x; - - x = zeroTo( len, 'generic' ); - mask = zeros( len, 'generic' ); - out = zeros( len, 'generic' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject.assign( x, mask, out, 1, 0 ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) || isnan( v[ i%len ] ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':assign:len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 014d259..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isArray = require( '@stdlib/assert-is-array' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// MAIN // - -bench( pkg+'::copy:len=100', function benchmark( b ) { - var x; - var y; - var i; - var v; - - x = zeroTo( 100 ); - y = zeros( x.length ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.js b/benchmark/benchmark.length.js deleted file mode 100644 index 2f09ef9..0000000 --- a/benchmark/benchmark.length.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pow = require( '@stdlib/math-base-special-pow' ); -var zeroTo = require( '@stdlib/array-base-zero-to' ); -var zeros = require( '@stdlib/array-base-zeros' ); -var isArray = require( '@stdlib/assert-is-array' ); -var pkg = require( './../package.json' ).name; -var mskreject = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = zeroTo( len ); - var y = zeros( len ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var v; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - v = mskreject( x, y ); - if ( typeof v !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( v ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d6cd587..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/mskreject" -%% click B href "https://github.com/stdlib-js/array-base-mskreject/tree/main" -%% click C href "https://github.com/stdlib-js/array-base-mskreject/tree/production" -%% click D href "https://github.com/stdlib-js/array-base-mskreject/tree/esm" -%% click E href "https://github.com/stdlib-js/array-base-mskreject/tree/deno" -%% click F href "https://github.com/stdlib-js/array-base-mskreject/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/mskreject -[production-url]: https://github.com/stdlib-js/array-base-mskreject/tree/production -[deno-url]: https://github.com/stdlib-js/array-base-mskreject/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-base-mskreject/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-base-mskreject/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-base-mskreject/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-base-mskreject/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 42f75e4..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import mskreject from '../docs/types/index'; -export = mskreject; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index c6e8afa..0000000 --- a/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict";var p=function(a,t){return function(){return t||a((t={exports:{}}).exports,t),t.exports}};var y=p(function(E,q){ -var f=require('@stdlib/array-base-resolve-getter/dist');function D(a,t){var e,v,n,r;for(e=f(a),v=f(t),n=[],r=0;r[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var arraylike2object = require( '@stdlib/array-base-arraylike2object' );\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = assign;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* var mskreject = require( '@stdlib/array-base-mskreject' );\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAmBjE,SAASC,EAAWC,EAAGC,EAAO,CAC7B,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOJ,EAAeE,CAAE,EACxBG,EAAOL,EAAeG,CAAK,EAG3BG,EAAM,CAAC,EACDC,EAAI,EAAGA,EAAIL,EAAE,OAAQK,IACpBF,EAAMF,EAAMI,CAAE,GACnBD,EAAI,KAAMF,EAAMF,EAAGK,CAAE,CAAE,EAGzB,OAAOD,CACR,CAKAP,EAAO,QAAUE,IChEjB,IAAAO,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAoB,QAAS,gDAAiD,EAC9EC,EAAmB,QAAS,qCAAsC,EAClEC,EAAc,QAAS,0CAA2C,EAClEC,EAAqB,QAAS,0CAA2C,EAyB7E,SAASC,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAIC,EACA,EAGJ,IADAA,EAAKD,EACC,EAAI,EAAG,EAAIJ,EAAE,OAAQ,IACpBC,EAAM,CAAE,IACbC,EAAKG,CAAG,EAAIL,EAAG,CAAE,EACjBK,GAAMF,GAGR,OAAOD,CACR,CA6BA,SAASI,EAAWN,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAClD,IAAIG,EACAC,EACAC,EACAC,EACAC,EACAC,EACAP,EACAQ,EAWJ,IATAN,EAAQP,EAAE,KACVQ,EAAQP,EAAK,KACbQ,EAAQP,EAAI,KAEZQ,EAAOV,EAAE,UAAW,CAAE,EACtBW,EAAOV,EAAK,UAAW,CAAE,EACzBW,EAAOV,EAAI,UAAW,CAAE,EAExBG,EAAKD,EACCS,EAAI,EAAGA,EAAIN,EAAM,OAAQM,IACxBF,EAAMH,EAAOK,CAAE,IACpBD,EAAMH,EAAOJ,EAAIK,EAAMH,EAAOM,CAAE,CAAE,EAClCR,GAAMF,GAGR,OAAOM,CACR,CAyBA,SAASK,EAASd,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAU,EACAF,EACAG,EAOJ,IALAR,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBc,EAAKZ,EAAS,EACdE,EAAKD,EAAS,EACRS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBG,EAAIH,EAAI,EACRX,EAAKG,CAAG,EAAIL,EAAGgB,CAAE,EACjBd,EAAKG,EAAG,CAAE,EAAIL,EAAGgB,EAAE,CAAE,EACrBX,GAAMU,GAGR,OAAOb,CACR,CAyBA,SAASe,EAASjB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAChD,IAAII,EACAG,EACAN,EACAQ,EAMJ,IAJAL,EAAQP,EAAK,KACbU,EAAOV,EAAK,UAAW,CAAE,EAEzBI,EAAKD,EACCS,EAAI,EAAGA,EAAIL,EAAM,OAAQK,IACxBF,EAAMH,EAAOK,CAAE,IACpBX,EAAKG,CAAG,EAAIL,EAAGa,CAAE,EACjBR,GAAMF,GAGR,OAAOD,CACR,CA0BA,SAASgB,EAAQlB,EAAGC,EAAMC,EAAKC,EAAQC,EAAS,CAC/C,IAAIe,EACAC,EACAC,EAKJ,OAHAF,EAAKvB,EAAkBI,CAAE,EACzBoB,EAAKxB,EAAkBK,CAAK,EAC5BoB,EAAKzB,EAAkBM,CAAI,EAE1BiB,EAAG,kBACHC,EAAG,kBACHC,EAAG,iBAIF3B,EAAmByB,EAAG,KAAM,GAC5BzB,EAAmB2B,EAAG,KAAM,GAE5BP,EAASjB,EAAaG,EAAG,CAAE,EAAGoB,EAAIvB,EAAaK,EAAK,CAAE,EAAGC,EAAQC,CAAO,EACjEF,GAGPP,EAAmBwB,EAAG,KAAM,GAC5BxB,EAAmB0B,EAAG,KAAM,GAE5BJ,EAASnB,EAAoBE,EAAG,CAAE,EAAGoB,EAAItB,EAAoBI,EAAK,CAAE,EAAGC,EAAQC,CAAO,EAC/EF,IAERI,EAAWa,EAAIC,EAAIC,EAAIlB,EAAQC,CAAO,EAC/BF,IAERH,EAASC,EAAGC,EAAMC,EAAKC,EAAQC,CAAO,EAC/BF,EACR,CAKAT,EAAO,QAAUyB,IC7NjB,IAAII,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "mskreject", "x", "mask", "xget", "mget", "out", "i", "require_assign", "__commonJSMin", "exports", "module", "isComplexDataType", "isBooleanDataType", "arraylike2object", "reinterpret", "reinterpretBoolean", "indexed", "x", "mask", "out", "stride", "offset", "io", "accessors", "xdata", "mdata", "odata", "xget", "mget", "oset", "i", "complex", "so", "j", "boolean", "assign", "xo", "mo", "oo", "setReadOnly", "main", "assign"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 2c6eac2..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,71 +0,0 @@ - -{{alias}}( x, mask ) - Returns a new array by applying a mask to a provided input array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - Returns - ------- - out: Array - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var y = {{alias}}( x, [ 0, 1, 0, 1 ] ) - [ 1, 3 ] - - -{{alias}}.assign( x, mask, out, stride, offset ) - Applies a mask to a provided input array and assigns unmasked values to - elements in a provided output array. - - If a mask array element is falsy, the corresponding element in `x` is - included in the output array; otherwise, the corresponding element in `x` is - "masked" and thus excluded from the output array. - - Parameters - ---------- - x: ArrayLikeObject - Input array. - - mask: ArrayLikeObject - Mask array. - - out: ArrayLikeObject - Output array. - - stride: integer - Output array stride. - - offset: integer - Output array offset. - - Returns - ------- - out: ArrayLikeObject - Output array. - - Examples - -------- - > var x = [ 1, 2, 3, 4 ]; - > var m = [ 0, 1, 0, 1 ]; - > var out = [ 0, 0, 0, 0 ]; - > var arr = {{alias}}.assign( x, m, out, 2, 0 ) - [ 1, 0, 3, 0 ] - > var bool = ( arr === out ) - true - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index dc64981..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 mskreject = require( './index' ); - - -// TESTS // - -// The function returns an array... -{ - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] - mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] - mskreject( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object... -{ - mskreject( 1, [ 0, 0 ] ); // $ExpectError - mskreject( true, [ 0, 0 ] ); // $ExpectError - mskreject( false, [ 0, 0 ] ); // $ExpectError - mskreject( null, [ 0, 0 ] ); // $ExpectError - mskreject( void 0, [ 0, 0 ] ); // $ExpectError - mskreject( {}, [ 0, 0 ] ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object... -{ - mskreject( [], 1 ); // $ExpectError - mskreject( [], true ); // $ExpectError - mskreject( [], false ); // $ExpectError - mskreject( [], null ); // $ExpectError - mskreject( [], void 0 ); // $ExpectError - mskreject( [], {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - mskreject(); // $ExpectError - mskreject( [] ); // $ExpectError - mskreject( [], [], [] ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 9d00581..0000000 --- a/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 zeroTo = require( '@stdlib/array-base-zero-to' ); -var bernoulli = require( '@stdlib/random-array-bernoulli' ); -var mskreject = require( './../lib' ); - -// Generate a linearly spaced array: -var x = zeroTo( 20 ); -console.log( x ); - -// Generate a random mask: -var mask = bernoulli( x.length, 0.5, { - 'dtype': 'generic' -}); -console.log( mask ); - -// Filter an array using the mask: -var y = mskreject( x, mask ); -console.log( y ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 92% rename from docs/types/index.d.ts rename to index.d.ts index 2a14e0d..5a8a3d0 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { Collection } from '@stdlib/types/array'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..89ef9d0 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-define-nonenumerable-read-only-property@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-resolve-getter@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-complex-floating-point-data-type@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-assert-is-boolean-data-type@v0.0.1-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/array-base-arraylike2object@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex@v0.1.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-boolean@v0.0.2-esm/index.mjs";function d(e,t){var r,o,a,n;for(r=s(e),o=s(t),a=[],n=0;n[ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ]\n*/\nfunction complex( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar so;\n\tvar i;\n\tvar j;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tso = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components\n\tio = offset * 2;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tj = i * 2;\n\t\t\tout[ io ] = x[ j ];\n\t\t\tout[ io+1 ] = x[ j+1 ];\n\t\t\tio += so;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array.\n*\n* @private\n* @param {Collection} x - boolean input array view\n* @param {Object} mask - mask array object\n* @param {Collection} out - boolean output array view\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array view\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import arraylike2object from '@stdlib/array-base-arraylike2object';\n*\n* var x = new Uint8Array( [ 1, 0, 0, 1 ] );\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = new Uint8Array( 4 );\n*\n* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 );\n* // returns [ 1, 0, 0, 0 ]\n*/\nfunction boolean( x, mask, out, stride, offset ) {\n\tvar mdata;\n\tvar mget;\n\tvar io;\n\tvar i;\n\n\tmdata = mask.data;\n\tmget = mask.accessors[ 0 ];\n\n\tio = offset;\n\tfor ( i = 0; i < mdata.length; i++ ) {\n\t\tif ( !mget( mdata, i ) ) {\n\t\t\tout[ io ] = x[ i ];\n\t\t\tio += stride;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array.\n*\n* @param {Collection} x - input array\n* @param {Collection} mask - mask array\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array offset\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\nfunction assign( x, mask, out, stride, offset ) {\n\tvar xo;\n\tvar mo;\n\tvar oo;\n\n\txo = arraylike2object( x );\n\tmo = arraylike2object( mask );\n\too = arraylike2object( out );\n\tif (\n\t\txo.accessorProtocol ||\n\t\tmo.accessorProtocol ||\n\t\too.accessorProtocol\n\t) {\n\t\t// Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland...\n\t\tif (\n\t\t\tisComplexDataType( xo.dtype ) &&\n\t\t\tisComplexDataType( oo.dtype )\n\t\t) {\n\t\t\tcomplex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\tif (\n\t\t\tisBooleanDataType( xo.dtype ) &&\n\t\t\tisBooleanDataType( oo.dtype )\n\t\t) {\n\t\t\tboolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len\n\t\t\treturn out;\n\t\t}\n\t\taccessors( xo, mo, oo, stride, offset );\n\t\treturn out;\n\t}\n\tindexed( x, mask, out, stride, offset );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default assign;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 mask to a provided input array.\n*\n* @module @stdlib/array-base-mskreject\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var y = mskreject( x, mask );\n* // returns [ 1, 3 ]\n*\n* @example\n* import mskreject from '@stdlib/array-base-mskreject';\n*\n* var x = [ 1, 2, 3, 4 ];\n* var mask = [ 0, 1, 0, 1 ];\n*\n* var out = [ 0, 0 ];\n* var arr = mskreject.assign( x, mask, out, 1, 0 );\n* // returns [ 1, 3 ]\n*\n* var bool = ( arr === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n"],"names":["mskreject","x","mask","xget","mget","out","i","resolveGetter","length","push","assign","stride","offset","xo","mo","oo","arraylike2object","accessorProtocol","isComplexDataType","dtype","mdata","io","so","j","data","accessors","complex","reinterpret","isBooleanDataType","boolean","reinterpretBoolean","xdata","odata","oset","indexed","setReadOnly","main"],"mappings":";;ywBAyCA,SAASA,EAAWC,EAAGC,GACtB,IAAIC,EACAC,EACAC,EACAC,EAQJ,IALAH,EAAOI,EAAeN,GACtBG,EAAOG,EAAeL,GAGtBG,EAAM,GACAC,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBF,EAAMF,EAAMI,IACjBD,EAAII,KAAMN,EAAMF,EAAGK,IAGrB,OAAOD,CACR,CC8KA,SAASK,EAAQT,EAAGC,EAAMG,EAAKM,EAAQC,GACtC,IAAIC,EACAC,EACAC,EAKJ,OAHAF,EAAKG,EAAkBf,GACvBa,EAAKE,EAAkBd,GACvBa,EAAKC,EAAkBX,GAEtBQ,EAAGI,kBACHH,EAAGG,kBACHF,EAAGE,iBAIFC,EAAmBL,EAAGM,QACtBD,EAAmBH,EAAGI,QA1GzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAC,EACAhB,EACAiB,EAOJ,IALAH,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBH,EAAc,EAATX,EACLU,EAAc,EAATT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBiB,EAAQ,EAAJjB,EACJD,EAAKgB,GAAOpB,EAAGsB,GACflB,EAAKgB,EAAG,GAAMpB,EAAGsB,EAAE,GACnBF,GAAMC,EAIT,CAsFGI,CAASC,EAAa1B,EAAG,GAAKa,EAAIa,EAAatB,EAAK,GAAKM,EAAQC,GAC1DP,GAGPuB,EAAmBf,EAAGM,QACtBS,EAAmBb,EAAGI,QAlEzB,SAAkBlB,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIQ,EACAhB,EACAiB,EACAf,EAMJ,IAJAc,EAAQlB,EAAKsB,KACbpB,EAAOF,EAAKuB,UAAW,GAEvBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIc,EAAMZ,OAAQF,IACxBF,EAAMgB,EAAOd,KAClBD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAmDGkB,CAASC,EAAoB7B,EAAG,GAAKa,EAAIgB,EAAoBzB,EAAK,GAAKM,EAAQC,GACxEP,IAvKV,SAAoBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACzC,IAAImB,EACAX,EACAY,EACA7B,EACAC,EACA6B,EACAZ,EACAf,EAWJ,IATAyB,EAAQ9B,EAAEuB,KACVJ,EAAQlB,EAAKsB,KACbQ,EAAQ3B,EAAImB,KAEZrB,EAAOF,EAAEwB,UAAW,GACpBrB,EAAOF,EAAKuB,UAAW,GACvBQ,EAAO5B,EAAIoB,UAAW,GAEtBJ,EAAKT,EACCN,EAAI,EAAGA,EAAIyB,EAAMvB,OAAQF,IACxBF,EAAMgB,EAAOd,KAClB2B,EAAMD,EAAOX,EAAIlB,EAAM4B,EAAOzB,IAC9Be,GAAMV,EAIT,CA+IEc,CAAWZ,EAAIC,EAAIC,EAAIJ,EAAQC,GACxBP,IAnNT,SAAkBJ,EAAGC,EAAMG,EAAKM,EAAQC,GACvC,IAAIS,EACAf,EAGJ,IADAe,EAAKT,EACCN,EAAI,EAAGA,EAAIL,EAAEO,OAAQF,IACpBJ,EAAMI,KACXD,EAAKgB,GAAOpB,EAAGK,GACfe,GAAMV,EAIT,CAyMCuB,CAASjC,EAAGC,EAAMG,EAAKM,EAAQC,GACxBP,EACR,CCjNA8B,EAAAC,EAAA,SAAA1B"} \ No newline at end of file diff --git a/lib/assign.js b/lib/assign.js deleted file mode 100644 index 02c5f00..0000000 --- a/lib/assign.js +++ /dev/null @@ -1,272 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' ); -var isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' ); -var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -var reinterpret = require( '@stdlib/strided-base-reinterpret-complex' ); -var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' ); - - -// FUNCTIONS // - -/** -* Applies a mask to an indexed array and assigns unmasked values to elements in an indexed output array. -* -* @private -* @param {Collection} x - input array -* @param {IntegerArray} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0, 0, 0 ]; -* -* var arr = indexed( x, mask, out, 1, 0 ); -* // returns [ 1, 3, 0, 0 ] -*/ -function indexed( x, mask, out, stride, offset ) { - var io; - var i; - - io = offset; - for ( i = 0; i < x.length; i++ ) { - if ( !mask[ i ] ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - -/** -* Applies a mask to an accessor array and assigns unmasked values to elements in an accessor output array. -* -* @private -* @param {Object} x - input array object -* @param {Object} mask - mask array object -* @param {Object} out - output array object -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = toAccessorArray( [ 1, 2, 3, 4 ] ); -* var mask = toAccessorArray( [ 0, 1, 0, 1 ] ); -* -* var out = toAccessorArray( [ 0, 0, 0, 0 ] ); -* var arr = accessors( arraylike2object( x ), arraylike2object( mask ), arraylike2object( out ), 1, 0 ); -* -* var v = arr.get( 0 ); -* // returns 1 -* -* v = arr.get( 1 ); -* // returns 3 -*/ -function accessors( x, mask, out, stride, offset ) { - var xdata; - var mdata; - var odata; - var xget; - var mget; - var oset; - var io; - var i; - - xdata = x.data; - mdata = mask.data; - odata = out.data; - - xget = x.accessors[ 0 ]; - mget = mask.accessors[ 0 ]; - oset = out.accessors[ 1 ]; - - io = offset; - for ( i = 0; i < xdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - oset( odata, io, xget( xdata, i ) ); - io += stride; - } - } - return odata; -} - -/** -* Applies a mask to a complex array and assigns unmasked values to elements in a complex output array. -* -* @private -* @param {Collection} x - real-valued floating-point input array view -* @param {Object} mask - mask array object -* @param {Collection} out - real-valued floating-point output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Float64Array( 8 ); -* -* var arr = complex( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0 ] -*/ -function complex( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var so; - var i; - var j; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - so = stride * 2; // note: multiply by 2, as real-valued array consists of interleaved real and imaginary components - io = offset * 2; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - j = i * 2; - out[ io ] = x[ j ]; - out[ io+1 ] = x[ j+1 ]; - io += so; - } - } - return out; -} - -/** -* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array. -* -* @private -* @param {Collection} x - boolean input array view -* @param {Object} mask - mask array object -* @param {Collection} out - boolean output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Uint8Array = require( '@stdlib/array-uint8' ); -* var arraylike2object = require( '@stdlib/array-base-arraylike2object' ); -* -* var x = new Uint8Array( [ 1, 0, 0, 1 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Uint8Array( 4 ); -* -* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 1, 0, 0, 0 ] -*/ -function boolean( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var i; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - io = offset; - for ( i = 0; i < mdata.length; i++ ) { - if ( !mget( mdata, i ) ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - - -// MAIN // - -/** -* Applies a mask to a provided input array and assigns unmasked values to elements in a provided output array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @param {Collection} out - output array -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ -function assign( x, mask, out, stride, offset ) { - var xo; - var mo; - var oo; - - xo = arraylike2object( x ); - mo = arraylike2object( mask ); - oo = arraylike2object( out ); - if ( - xo.accessorProtocol || - mo.accessorProtocol || - oo.accessorProtocol - ) { - // Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland... - if ( - isComplexDataType( xo.dtype ) && - isComplexDataType( oo.dtype ) - ) { - complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - if ( - isBooleanDataType( xo.dtype ) && - isBooleanDataType( oo.dtype ) - ) { - boolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } - accessors( xo, mo, oo, stride, offset ); - return out; - } - indexed( x, mask, out, stride, offset ); - return out; -} - - -// EXPORTS // - -module.exports = assign; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 819f070..0000000 --- a/lib/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 mask to a provided input array. -* -* @module @stdlib/array-base-mskreject -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -* -* @example -* var mskreject = require( '@stdlib/array-base-mskreject' ); -* -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = [ 0, 0 ]; -* var arr = mskreject.assign( x, mask, out, 1, 0 ); -* // returns [ 1, 3 ] -* -* var bool = ( arr === out ); -* // returns true -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index a50ae36..0000000 --- a/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolveGetter = require( '@stdlib/array-base-resolve-getter' ); - - -// MAIN // - -/** -* Returns a new array by applying a mask to a provided input array. -* -* @param {Collection} x - input array -* @param {Collection} mask - mask array -* @returns {Array} output array -* -* @example -* var x = [ 1, 2, 3, 4 ]; -* var mask = [ 0, 1, 0, 1 ]; -* -* var y = mskreject( x, mask ); -* // returns [ 1, 3 ] -*/ -function mskreject( x, mask ) { - var xget; - var mget; - var out; - var i; - - // Resolve accessors for retrieving array elements: - xget = resolveGetter( x ); - mget = resolveGetter( mask ); - - // Extract each desired element from the provided array... - out = []; - for ( i = 0; i < x.length; i++ ) { - if ( !mget( mask, i ) ) { - out.push( xget( x, i ) ); // use `Array#push` to ensure "fast" elements - } - } - return out; -} - - -// EXPORTS // - -module.exports = mskreject; diff --git a/package.json b/package.json index e690ae8..6cc9697 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.3.0", "description": "Apply a mask to a provided input 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,54 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-base-arraylike2object": "^0.2.1", - "@stdlib/array-base-assert-is-boolean-data-type": "^0.0.1", - "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1", - "@stdlib/array-base-resolve-getter": "^0.2.2", - "@stdlib/strided-base-reinterpret-boolean": "^0.0.2", - "@stdlib/strided-base-reinterpret-complex": "^0.1.2", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-base-to-accessor-array": "^0.2.2", - "@stdlib/array-base-zero-to": "^0.2.1", - "@stdlib/array-base-zeros": "^0.2.2", - "@stdlib/array-bool": "^0.1.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-int32": "^0.2.2", - "@stdlib/array-zeros": "^0.2.2", - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-equal-booleanarray": "github:stdlib-js/assert-is-equal-booleanarray#main", - "@stdlib/assert-is-method": "^0.2.2", - "@stdlib/assert-is-nan": "^0.2.2", - "@stdlib/assert-is-same-complex64": "^0.2.2", - "@stdlib/assert-is-same-complex64array": "^0.2.2", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-array-bernoulli": "^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", "utilities", @@ -102,4 +31,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..308a3e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.assign.js b/test/test.assign.js deleted file mode 100644 index cf67eff..0000000 --- a/test/test.assign.js +++ /dev/null @@ -1,349 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var toAccessorArray = require( '@stdlib/array-base-to-accessor-array' ); -var Int32Array = require( '@stdlib/array-int32' ); -var isSameComplex64Array = require( '@stdlib/assert-is-same-complex64array' ); -var isEqualBooleanArray = require( '@stdlib/assert-is-equal-booleanarray' ); -var zeros = require( '@stdlib/array-zeros' ); -var mskreject = require( './../lib/assign.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements (generic)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'generic' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (real typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Int32Array( [ 1, 2, 3, 4 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 2, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Int32Array( [ 1, 2, 3, 4 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'int32' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Int32Array( [ 0, 4, 0, 2 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (complex typed array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 2, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 3.0, 4.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = zeros( 0, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = zeros( 1, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = zeros( 4, 'complex64' ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new Complex64Array( [ 0.0, 0.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (boolean array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new BooleanArray( [ true, false, false, true ] ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 2 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isEqualBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = new BooleanArray( 0 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isEqualBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 0 ]; - out = new BooleanArray( 1 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isEqualBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true, false, false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isEqualBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 0, 1, 0 ]; - out = new BooleanArray( 4 ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = new BooleanArray( [ false, true, false, false ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isEqualBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 2, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 2, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 1 ] ); - out = toAccessorArray( zeros( 0, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = []; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 1, 1, 0 ] ); - out = toAccessorArray( zeros( 1, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 0, 0, 0, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, 1, 0 ); - expected = [ 1, 2, 3, 4 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - mask = toAccessorArray( [ 1, 0, 1, 0 ] ); - out = toAccessorArray( zeros( 4, 'generic' ) ); - actual = mskreject( x, mask, out, -2, out.length-1 ); - expected = [ 0, 4, 0, 2 ]; - - t.strictEqual( actual, out, 'returns expected value' ); - isEqual( actual, expected ); - - t.end(); - - function isEqual( actual, expected ) { - var i; - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual.get( i ), expected[ i ], 'returns expected value' ); - } - } -}); - -tape( 'the function returns leaves an output array unchanged if provided a second argument which masks all input array values', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - mask = [ 1, 1, 1, 1 ]; - - x = [ 1, 2, 3, 4 ]; - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = toAccessorArray( [ 1, 2, 3, 4 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Int32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = [ 0, 0, 0, 0 ]; - expected = [ 0, 0, 0, 0 ]; - actual = mskreject( x, mask, out, 1, 0 ); - t.deepEqual( actual, expected, 'returns expected value' ); - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - expected = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - - x = new BooleanArray( [ true, false, false, true ] ); - out = new BooleanArray( [ false, false, false, false ] ); - expected = new BooleanArray( [ false, false, false, false ] ); - actual = mskreject( x, mask, out, 1, 0 ); - t.strictEqual( isEqualBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index da68fa8..0000000 --- a/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasMethod = require( '@stdlib/assert-is-method' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is an `assign` method', function test( t ) { - t.strictEqual( hasOwnProp( mskreject, 'assign' ), true, 'returns expected value' ); - t.strictEqual( hasMethod( mskreject, 'assign' ), true, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.main.js b/test/test.main.js deleted file mode 100644 index 07a1eb5..0000000 --- a/test/test.main.js +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var BooleanArray = require( '@stdlib/array-bool' ); -var isSameComplex64 = require( '@stdlib/assert-is-same-complex64' ); -var isArray = require( '@stdlib/assert-is-array' ); -var mskreject = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof mskreject, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function rejects array elements', function test( t ) { - var expected; - var actual; - var mask; - var x; - - x = [ 1, 2, 3, 4 ]; - - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ 1, 2, 3 ]; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - actual = mskreject( x, mask ); - expected = []; - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns new array' ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function rejects array elements (accessors)', function test( t ) { - var expected; - var actual; - var mask; - var x; - var i; - - x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); - } - - x = new BooleanArray( [ true, false, false, true ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskreject( x, mask ); - expected = [ x.get( 0 ), x.get( 2 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } - - t.end(); -}); - -tape( 'the function returns an empty array if provided empty arrays', function test( t ) { - t.deepEqual( mskreject( [], [] ), [], 'returns expected value' ); - t.end(); -});